From owner-freebsd-questions Wed Sep 26 21:21:39 2001 Delivered-To: freebsd-questions@freebsd.org Received: from sylvester.dsj.net (sylvester.dsj.net [208.148.151.43]) by hub.freebsd.org (Postfix) with ESMTP id B29F937B417 for ; Wed, 26 Sep 2001 21:21:35 -0700 (PDT) Received: (from dsj@localhost) by sylvester.dsj.net (8.9.3/8.9.3/Debian 8.9.3-21) id AAA30666; Thu, 27 Sep 2001 00:21:34 -0400 Date: Thu, 27 Sep 2001 00:21:34 -0400 From: "David S. Jackson" To: freebsd-questions@freebsd.org, ale@ale.org, kplug-list@kernel-panic.org Subject: regex w/ sed and bash expression Message-ID: <20010927002134.A30622@sylvester.dsj.net> Reply-To: "David S. Jackson" Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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@dsj.net =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= I base my fashion taste on what doesn't itch. -- Gilda Radner To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message