AWK merging the lines

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

AWK merging the lines

abmanyu
Hi,I have input file like below
Unix
Linux
Solaris
AIX
Sco
I need output like below
unix linux
Solaris AIX Sco

awk '/linux/{print "Linux";next}{printf "%s ",$0}END{print "";}' filename

Instead of achieving by searching with linux, i need to get the output using the line number i.e 2 not using linux.


Reply | Threaded
Open this post in threaded view
|

Re: AWK merging the lines

Guru
Administrator
There is no pattern in the expected output. Are you trying to join every 2 lines?