I have a (CSV) file that I want to split in two. I want all the even lines to go to one file, and all the odd lines to go to another file.
$ ls -1 FILE [MAGIC] $ ls -1 FILE ALL_THE_EVEN_LINES ALL_THE_ODD_LINES |
This is how to do it in two passes using awk:
awk 'NR%2==0' FILE > ALL_THE_EVEN_LINES awk 'NR%2==1' FILE > ALL_THE_ODD_LINES |