Supressing new-lines in awk output
Paul S. Sawyer
pss at unh.UUCP
Tue Feb 7 05:01:13 AEST 1989
In article <21638 at conexch.UUCP>, root at conexch.UUCP (Larry Dighera) writes:
> Is there a way to supress the newline at the end of awk's print output?
>
> Given:
>
> awk '{print $1}' filename
>
Try:
awk '{ printf ("%s ", $1) }' filename
(You would need
awk '{ printf ("%s\n", $1) }' filename
to equal the unformatted awk "print" statement) You can also do tricks with
setting a variable to be a space for, say 5 input lines and a newline on the
sixth for six column output. Awk is really quite versatile (even oawk), if
you are stubborn enough!
More information about the Comp.unix.questions
mailing list