procmail
[Top] [All Lists]

Re: Removing multiple spaces from Subject lines was Re: long mailing-list names in Subject line

2001-04-04 11:37:31
Timothy J. Luoma wrote:
[snip]
You had
       SUBJECT=`formail -xSubject: | sed s'/  / /'g`

which should have been

      SUBJECT=`formail -xSubject: | sed 's/  / /g'`

(Note the 's not s' and g' not 'g)

No, those are equivalent.  If you don't believe it, try:
        echo s'/  / /'g | od -c
        echo 's/  / /g' | od -c
In each case, there is one argument to "echo", and they're
the same as the single argument to sed in the above cases.

One could also equivalently write:
         SUBJECT=`formail -xSubject: | sed s/'  '/' '/g`
or even:
         SUBJECT=`formail -xSubject: | sed s/' '' '/' '/g`

Of course, as you noted, '/  */' matches one or more spaces.
This one:
        SUBJECT=`formail -xSubject: | sed -e 's/  */ /g' -e 's/^  *//'`
will get rid of all multiple spaces AND any leading space(s).

Stan
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>
  • Re: Removing multiple spaces from Subject lines was Re: long mailing-list names in Subject line, Stan Ryckman <=