Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 28 Sep 2001 02:02:02 -0400
From:      parv <parv_@yahoo.com>
To:        "David S. Jackson" <dsj@sylvester.dsj.net>
Cc:        f-q <freebsd-questions@freebsd.org>
Subject:   Re: regex w/ sed and bash expression
Message-ID:  <20010928020202.A3002@moo.holy.cow>
In-Reply-To: <20010927163858.A2643@sylvester.dsj.net>; from dsj@sylvester.dsj.net on Thu, Sep 27, 2001 at 04:38:58PM -0400
References:  <20010927002134.A30622@sylvester.dsj.net> <20010927010644.A27260@moo.holy.cow> <20010927163858.A2643@sylvester.dsj.net>

next in thread | previous in thread | raw e-mail | index | archive | help
this was, on the fateful occasion around Sep 27 16:38 -0400,
sent by David S. Jackson                                             
>
> On Thu, Sep 27, 2001 at 01:06:44AM -0400 parv <parv_@yahoo.com> wrote:
> > hi again david,
> > 
> > how about this...
> > 
> > # echo '[ ] popop l' | perl -p -e 's#([\W])#\\$1#g'
> 
> You know, I like Jim's and Fletch's response:
> 
> file=`echo '[foo (bar) baz]' | perl -ne 'print quotemeta $_'`

use of 'quotemeta' function makes the program more readable, i must 
say...  but introduces need of 'print' function due to -n option. 

thanks for sharing as other responses didn't seem to make the list.

in any case, let me remove some junk from my response...

# echo '[ ] popop l' | perl -p -e 's#(\W)#\\$1#g'

- parv

-- 


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010928020202.A3002>