[Techtalk] .signature-munging

Hamster hamster at hamsternet.org
Mon Aug 12 13:14:40 EST 2002


> > I pipe my mails through a SED script to turn Mailman's
> > "_______________________________________________" line into "-- "
> > anyway.
> 

Here is one possible way:

The idea is to match two or more '-' and replace with '-- '

sed 's/-\{3,\}/-- /g'

To try and translate:

s/	# is the start of the command
-	#is the char you want to match, this is hyphen, 
	#could replace with _ underscore or whatever as necessary
\{3,\}	#means 'where there is three more of the preceding character', 
	#in this case a -
/-- /	#is what to replace any matches with
g	#is replace all occurances on each line, not just the first one.

I chose the number three because I thought that that way if in the text of an email someone gives an example of a command like foo --help, it wont stuff up the two -- in the command example.

Hope this has helped a bit.

Hamster




More information about the Techtalk mailing list