I understand your problem as a data file with extra line breaks, which means that where you want to have the data<NL>moredata , you have things like data<NL><NL>moredata .
Here's a sample to cut / paste into your command line, which uses documents here to create a dataset and runs an m4 script to remove gaps in the dataset. You can see that patsubst replaces each instance of one or more lines of a new line in the sequence ( <NL><NL>* ) with exactly one new line.
cat > data << ----- 1, 2 3, 4 5, 6 7, 8 9, 10 11, 12 e ----- m4 << "-----" define(`rmbreaks', `patsubst(`$*', ` *', ` ')')dnl rmbreaks(include(data))dnl -----
source share