I did the "hardwork" going through all special characters in ERE,PERL (I hope)
in /usr/local/bin/ssed
#!/bin/sh
file="$1"
if [ -n "$file" ]; then
sed "s#[@/\^.$|()[*+?{}\#,&=:~]\|-\|\]#\\\&#g" "$file"
else
sed "s#[@/\^.$|()[*+?{}\#,&=:~]\|-\|\]#\\\&#g"
fi
Example Usage:
$ grep '^[^#]' mirrorlist | ssed | xargs -d'\n' -I{} sed -i '/{}/ s/#//' mirrorlist.pacnew
In this case I needed to go through all urls in mirrorlist.pacnew
and uncomment those which are in mirrorlist
uncommented.