procmail
[Top] [All Lists]

catching backslashes with sed

2002-09-13 22:42:10
I'm trying to construct a filename out of an email address, using
sed to x-out all the metacharacters, and seem to have mostly
succeeded with:

        :0 wh
        FROM=| formail -rt -x To:              

        FILE=`echo $FROM | sed \
        -e 'y/~!(_at_)#$%^&*()_-+={[}]:;"<,>?|/xxxxxxxxxxxxxxxxxxxxxxxxxxx/' \
        -e 'y/\//x/' \
        -e 'y/./x/' \
        -e 'y/\`/x/' \
        -e 'y/\\/x/' `

Except for the last sed expression to replace backslashes with 'x' :-(

Depending on the number of escaping backslashes, I get either:

sed: -e expression #5, char 4: Extra characters after command

or 

sed: -e expression #5, char 6: Unexpected End-of-file

Whether the expression is quoted or not doesn't seem to make a
difference.  

The man pages and sed FAQ don't seem to have the
answers. The info documentation for GNU sed says the single
escaping backslash above should work, just like it does for
forwardslash. But it doesn't. 

Does anyone have any advice?

-- 
Greg Matheson               Whereof we cannot speak, we must remain silent.
Chinmin College             --Ludwig Wittgenstein

Taiwan Penpals Archive <URL: http://netcity.hinet.net/kurage>
_______________________________________________
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>