From owner-freebsd-questions Wed Sep 26 22: 7:36 2001 Delivered-To: freebsd-questions@freebsd.org Received: from swan.mail.pas.earthlink.net (swan.mail.pas.earthlink.net [207.217.120.123]) by hub.freebsd.org (Postfix) with ESMTP id CA68337B50C for ; Wed, 26 Sep 2001 22:07:31 -0700 (PDT) Received: from moo.holy.cow (sdn-ar-007dcwashP264.dialsprint.net [63.178.90.154]) by swan.mail.pas.earthlink.net (EL-8_9_3_3/8.9.3) with ESMTP id WAA07272; Wed, 26 Sep 2001 22:06:01 -0700 (PDT) Received: by moo.holy.cow (Postfix, from userid 1001) id 207A050BAA; Thu, 27 Sep 2001 01:06:44 -0400 (EDT) Date: Thu, 27 Sep 2001 01:06:44 -0400 From: parv To: "David S. Jackson" Cc: freebsd-questions@freebsd.org, ale@ale.org, kplug-list@kernel-panic.org Subject: Re: regex w/ sed and bash expression Message-ID: <20010927010644.A27260@moo.holy.cow> Mail-Followup-To: "David S. Jackson" , freebsd-questions@freebsd.org, ale@ale.org, kplug-list@kernel-panic.org References: <20010927002134.A30622@sylvester.dsj.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20010927002134.A30622@sylvester.dsj.net>; from dsj@sylvester.dsj.net on Thu, Sep 27, 2001 at 12:21:34AM -0400 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 this was, on the fateful occasion around Sep 27 00:21 -0400, sent by David S. Jackson > > 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 ... hi again david, how about this... # echo '[ ] popop l' | perl -p -e 's#([\W])#\\$1#g' ...that will also escape the 'new line', as in... \[\ \]\ popop\ l\ ...you can always adjust \W character class as appropriate, of course. sorry if i seem perl-happy, but i rather not deal w/ sed-shell interaction related to escape/quoting. -- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message