Joining groups of lines in a text file.
The prints three consecutive lines of text on the same line, after which a linefeed is printed. This has the effect of “joining” every three consecutive lines of text.
example.txt
1 2 3 4 5 6 7 8 9
ex357.txt
awk -F" " '{ printf("%d",$0) if(NR % 3 == 0) { printf("\n") } }' example.txt
output:
123 456 789
Recent Comments