I have some files with content that change from file to file. Each file have 2 sections of lines separated by a blank line. I never know how many lines or characters there are in either section.
The file can look something like this.
This is a file
with some text
and some more text
This code only gives the first line from each section.
awk 'BEGIN {RS="\n\n"; FS="\n";} {print $1 }' file
I need each section split up to work with.
Prints first part:
sed '/^$/q' test.txt
Prints second part:
sed '1,/^$/d' test.txt
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With