regex w/ sed and bash expression
David S. Jackson
dsj at sylvester.dsj.net
Wed Sep 26 21:21:34 PDT 2001
Hi,
I'm trying to make a variable expand to include a list of
filenames with braces and parens as part of the filename. (The
files are mp3s with brackets and parens, etc, in the filenames
themselves.) I just want the resulting expansion to insert an
escape character infront of spaces and special characters so the
shell can find them.
Example: don mclean - american pie (uncut version).mp3
and [John Wayne]-[Pledge_of_Allegiance].mp3
What I've got so far is:
*** snip ***
files=`cat listofwavs.txt | sed -e 's/\([( )\]]\)/\\1/gp'`
burncd -f /dev/acd1c -s ${cdrspeed} -e audio \
"${audiopath}/${files}" fixate
*** snip ***
But if I go echo "[" | sed -e 's/\([( )\]]\)/\\1/gp' it just
returns "[" without the escape. :-(
The group I want to catch is " ", "(", ")", "[", "]".
I want the expansion to create "\ ", "\(", "\)", "\[", "\]".
Any ideas?
TIA.
--
David S. Jackson dsj at dsj.net
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
I base my fashion taste on what doesn't itch.
-- Gilda Radner
More information about the KPLUG-List
mailing list