I am trying to figure out how to move all even lines to the beginning of all odd lines as follows:
before:
AAA
BBB
CCC
DDD
after:
BBBAAA
DDDCCC
Something I can run on multiple files at once would be great since combining all the files using cat results in a file that is too big to deal with. Something similar to the following command for doing text swapping so that I can add it to a bash file:
find /directory/. -type f -exec sed -i 's/oldtext/newtext/g' {} \;
I have searched but I haven't found something suitable.
To make things easier I can add 'string1' to the beginning of all odd lines and 'string2' to the beginning of all even lines as follows:
before:
string1AAA
string2BBB
string1CCC
string2DDD
after:
string2BBBstring1AAA
string2DDDstring1CCC
Big thanks.