I have a text file,
a1
a2
b1
b2
c1
c2
...
I want to join by two lines so one can sort it:
a1:a2
b1:b2
c1:c2
...
I’m using bash. the read function will eat the leading space, which is undesired. And I hate to write simple stupid C programs.
Then, I can use tr : "\n" to split the joined file back to two files.
paste -s -d ':\n' fileshould do it.For example: