Afficher un message
Vieux 21/08/2006, 07h03   #1
Troy Piggins
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut awk script to insert blank line between matching patterns

I'm not too good with awk, but I don't think this can be done
with sed.

I pass email/usenet messages through my message filter to 'clean'
them up. Currently I have the script below [1](with some personal
lines removed). As you can see, the message is piped through
sed, then t-prot (a tidying up script I found by Jochen Striepe),
then finally 'mail-to-filter' (a perl script by Gary Johnson).

I want to add an awk script that adds a blank line to messages just
above the signature delimiter if there isn't a blank line there
already. So if the end of the email ends with:

....
Thanks,
Fred
--
Fred's sig here
blahblah

I'd like my display filter to add blank line like this:

....
Thanks,
Fred

--
Fred's sig here
blahblah

If there was already a blank line there, then do nothing.
Any ideas or pushes in the right direction?

[1]
-----8<-----
#!/bin/bash

sed -e '

# fix incorrect sig delimiters
s/^--$/-- /
s/^_____.*/-- /
s/^\*\*\*\*\*.*/-- /

# some lines deleted

' \
\
| t-prot -aceklmt -S=5 --bigq=20,10 --diff -Mmutt --sigsmax
--spass -L${HOME}/.mutt/mlfooters -A${HOME}/.mutt/adfooters \
\
| mail-to-filter
-----8<-----

--
Troy Piggins
,-o
o )
`-o
  Réponse avec citation
 
Page generated in 0,05681 seconds with 9 queries