in reply to Format, empty vars, and fixed-width records
I also tried using sprintf, but if the data is longer than intended, the line becomes too long.
You do know you can specify the maximum width?
printf "%2.2s>%32.32s<\n", $_, 'x' x $_ for 30 .. 34, 99..101;; 30> xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx< 31> xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx< 32>xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx< 33>xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx< 34>xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx< 99>xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx< 10>xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx< 10>xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx<
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Format, empty vars, and fixed-width records
by kwaping (Priest) on Apr 21, 2008 at 23:40 UTC | |
by BrowserUk (Patriarch) on Apr 22, 2008 at 00:14 UTC | |
by ikegami (Patriarch) on Apr 22, 2008 at 02:56 UTC | |
by BrowserUk (Patriarch) on Apr 22, 2008 at 03:32 UTC |