On Mon, Jul 05, 2010 at 12:42:51PM +0200, Bret S. Lambert wrote: > On Mon, Jul 05, 2010 at 06:35:01PM +0800, Aaron Lewis wrote: > > -----BEGIN PGP SIGNED MESSAGE----- > > Hash: SHA1 > > > > Hi, > > echo %A3 | sed 's/(%[0-9A-Z]{2})//g' > > > > I'd like %A3 like string to be removed , what's wrong with my script ? > > > > According to the sed manpage, it doesn't use {} in this way; you seem > to be using the wrong syntax (although sed veterans can likely give a > more thorough answer). > > try sed 's/%[0-9A-Z][0-9A-Z]//g' (minus any typos/thinkos on my part)
sed(1) uses basic regular expressions (see re_format(7) for details). In particular, you should prepend with a backslash the parentheses and braces in the original example, although the parentheses are superfluous for the stated purpose. If you want to use bounds, then echo %A3 | sed 's/%[0-9A-Z]\{2\}//g' will do.