[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Problem with sed s command



I use KMail to read this and other mailing lists. When replying to a 
message, KMail will look for the last instance of <new 
line><dash><dash><space><return> and remove that and everything below 
from the reply. A problem occurs however on mailing lists that use that 
format to delimit the unsubscribe info when the author has also used it 
since KMail will then only remove the unsubscribe info and not the 
author's sig.

The solution seems simple enough - use a KMail filter to pipe messages 
through sed to remove the second signature delimiter if there is one. 
Here is the sed script I am using but it doesn't work as expected:

sed s/'^\-\-\ '//2

From my understanding of the man and info pages, this should look for 
the second instance of <dash><dash><space> and replace it with nothing. 
Unfortunately it doesn't. If I remove the 2 sed removes *all* cases 
(rather than just the first as I would expect). Same thing happens if I 
replace it with 1 or g (g is not surprising, but 1 and nothing are). 
Other numbers are similarly ineffective on test cases with insane 
numbers of sig delimiters.

Any hints?
-- 
David P James
Ottawa, Ontario
http://david.jamesnet.ca
ICQ: #42891899, Jabber: davidpjames@jabber.org



Reply to: