On Thu, 11 Jan 2024, Ben Koenig wrote:

I came up with an extremely crude way to do this with bash/grep/sed. For your 
testfile.txt

grep "^ *$" testfile.txt -A1 --no-group-separator | sed  '/^ *$/d'

The pattern "^ *$" matches empty lines. grep provides the -A$N to return N 
lines after the matching line. sed then removes the empty line returned by grep.

If the file does not start with an empty line then the first paragraph is 
missed, but you can probably find a solution to that problem.

Ben,

Thank you.

Regards,

Rich

Reply via email to