Split text file into multiple files

awk, bash, unix

Solution

You can use split and set "NUMBER lines per output file" to 2. Each file would have one text line and one empty line.

split -l 2 file

Problem

I am having large text file having 1000 abstracts with empty line in between each abstract . I want to split this file into 1000 text files. My file looks like ``` 16503654 Three-dimensional structure of neuropeptide k bound to dodecylphosphocholine micelles. Neuropeptide K (NPK), an N-terminally extended form of neurokinin A (NKA), represents the most potent and longest lasting vasodepressor and cardiomodulatory tachykinin reported thus far. 16504520 Computer-aided analysis of the interactions of glutamine synthetase with its inhibitors. Mechanism of inhibition of glutamine synthetase (EC 6.3.1.2; GS) by phosphinothricin and its analogues was studied in some detail using molecular modeling methods. ```

Original source