Hello Everyone,
I have a large file that needs to be split into many seperate files, however the text in between the blank lines need to be intact. The file looks like
SomeText
SomeText
SomeText
SomeOtherText
SomeOtherText
....
Since the number of lines of text are different for each entry, my only real marker is a blank line. I have tried the following
cat largetxtfile.txt | awk -f
BEGIN{i=0}
{
if($0=="")
{
++linecount;
}
if(linecount%500 != 0)
{
print $0 >> i".txt"
}
else
{
++i
}
}
This should split the file at every 500 entries to a separate file. It sort of works but doubles up the files, I'm not sure if my logic is wrong.
Please Help.
J