please help me on this....
cat /xx.txt
2:1
2
2:2
24
8:0
0
9:0
0
Expected result would be
2:1 2
2:2 24
8:0 0
9:0 0
please help me on this....
cat /xx.txt
2:1
2
2:2
24
8:0
0
9:0
0
Expected result would be
2:1 2
2:2 24
8:0 0
9:0 0
awk '/:/ && s {print s; s=x} {s=s?s FS $0:$0} END{if(s) print s}' file
awk '/:/{ORS=FS}!/:/{ORS=RS}1' file
Don't forget the paste command:
paste -s -d' \n' file
Other approaches:
xargs -n2 < file
paste -d' ' - - < file