To create a column header, looking like:
1234567890123456789
I (am trying to) use seq and echo:
seq -s '' 1 9 ; echo -n 0; seq -s '' 1 9
However, seq outputs a newline after each run. How can I avoid that?
.seqgnu
To create a column header, looking like:
1234567890123456789
I (am trying to) use seq and echo:
seq -s '' 1 9 ; echo -n 0; seq -s '' 1 9
However, seq outputs a newline after each run. How can I avoid that?
Best Answer
Assuming you just want to print
1234567890123456789
, you can do it with:That won't have a trailing newline at all though, so maybe you prefer:
A few simpler choices if you don't need to use
seq
:Since you mentioned portability, I recommend you use the
perl
approach, or if you are likely to encounter systems withoutperl
, and yet need the same command to run in shells includingbash
,sh
,dash
,tcsh
etc, try Kamil's approach.