Swap Every Two Lines in Text File using Awk
This swaps every two lines of input.
Given this input.txt
1wan
2tew
3free
4phore
Ouput the following:
1tew
2wan
3phore
4free
Full command to run:
1~$ cat input.txt | awk '{
2 if ((getline tmp) > 0) {
3 print tmp
4 print $0
5 } else
6 print $0
7}'