|
awk group 2 lines
Hello,
I have a file with n number of lines where every 2 lines are grouped. So I want to print the items in a line and the next line in a single line.
For example:
[~]# cat temp
aaa bbb ccc
123 145
fgdfg fg fgdf
34 232
I can print the line and the adjacent together and print the required items like this:
[~]# cat temp|awk '{print $1":"$3;getline;print $2}'
aaa:ccc
145
fgdfg:fgdf
232
But that's not the order I want. How can I get it printed like below:
aaa:145:ccc
fgdfg:232:fgdf
|