Path: utzoo!utgpu!attcan!uunet!unh!pss From: pss@unh.UUCP (Paul S. Sawyer) Newsgroups: comp.unix.questions Subject: Re: Supressing new-lines in awk output Summary: Use printf Keywords: awk Message-ID: <911@unh.UUCP> Date: 6 Feb 89 19:01:13 GMT References: <21638@conexch.UUCP> Organization: UNH Telecommunications Lines: 19 In article <21638@conexch.UUCP>, root@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!