* Rakesh Sharma <sharma__r@hotmail.com> :
>
> the tool 'sed' normally operates on a line-by-line basis with it's
> input. but in your case we need to carry with us two lines all
> the time, since we need to base our decision after looking at the
> signature line and also the line preceding it (whether it was a blank
> or not).
>
> $!N -> will make the pattern space comprise 2 lines separated by
> a newline (\n), unless we reach the end of file.
[excellent description snipped]
Thankyou Rakesh for taking the time to type all that. Your
patience is appreciated. I think I understand most of what you
said. I'll read some more.
For the record, I added the following lines into my script and it
works a treat:
sed -e '
# snip other lines
# put a space before sig delimiters
$!N
/^\n/{P;D;}
/\n.*-- /!{P;D;}
s/\n/&&/
'
The standard email sig delimiter, as you know, is "-- ".
Cheers
--
Troy Piggins
,-o
o ) Ubuntu linux 6.06
http://ubuntu.com RLU#415538
http://counter.li.org
`-o uptime: 23:03:56 up 12 days,16:00,2 users,load average:0.10,0.12,0.05