On Thursday, January 11th, 2024 at 1:01 PM, Rich Shepard 
<[email protected]> wrote:


> On Thu, 11 Jan 2024, Michael Ewan wrote:
> 
> > You can send mail directly from Python. Check
> > https://realpython.com/python-send-email/
> 
> 
> Michael,
> 
> Since Python can do so many things I should have expected this. Wasn't aware
> of it before now.
> 
> Many thanks,
> 
> Rich

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

Reply via email to