[Techtalk] filtering command line

Conor Daly conor.daly-linuxchix at cod.homelinux.org
Mon Jun 11 14:31:05 UTC 2007


On Mon, Jun 11, 2007 at 09:42:03PM +1000 or so it is rumoured hereabouts, 
Miriam English thought:
> 
> After doing a fair bit of reading I have a feeling I might need to use 
> sed with something like
> s/\//\\/g

The fun thing with sed is when you start trying to escape characters.  It
can get very messy very fast.   However, sed allows you to use any
delimiter in your expression.  So, in the case where you want to match a
'/', you could do something like:

s@/@\\@g

where '@' is now the pattern delimiter.  There is probably a way to tell
sed to use a different escape character so that you could do:

s@/@\@g

but I have no clue how to do that...


All that said, tr works nicely in this case...

Conor

-- 
Conor Daly <conor.daly at cod.homelinux.org>
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS/G/S/O d+(-) s:+ a+ C++(+) UL++++ US++ P>++ L+++>++++ E--- W++ !N
PS+ PE Y+ PGP? tv(-) b+++(+) G e+++(*) h-- r+++ z++++ 
------END GEEK CODE BLOCK------
http://www.geekcode.com/ http://www.ebb.org/ungeek/


More information about the Techtalk mailing list