[GLLUG] Grep or ls or tail or something

Sean picasso@madflower.com
Sun, 27 Jan 2002 21:30:27 -0500 (EST)


Its regexp or regular expression charactor substitution. basically it is
the the syntax of
s///g
the s means substitute, the g means do this as many times as you match the
expression per evaluated name.

the /// break up into /<find this>/<replace with this>/
the \ is an escape charactor.
stuff between the brackets means match any of these.
the ^ means match from the beginning.

so you are matching all charactory a-z all charactors A-Z, -, -, .

In the replacement you are replacing with a \ and the \1 is basically a
variable for whatever you matched in the first part of the expression.

correct me if that is wrong but that is pretty close..




On Mon, 28 Jan 2002, Mike Szumlinski wrote:

> Okay, the third one worked perfectly. Thanks.
>
> Now, could you do myself and probably a couple other people on the list a
> favor and tell me what the hell all the slashes and brackets mean in this?
>
> -Mike
>
> On 1/26/02 1:58 AM, "Ben Pfaff" <blp@cs.stanford.edu> wrote:
>
> >
> > Perhaps
> >       find . -type f -print0 | xargs -0 ls -Q
> > or maybe
> >       find . -type f | sed 's/\(.*\)/"\1"/;'
> > or
> >       find . -type f | sed 's/\([^./a-zA-Z0-9_-]\)/\\\1/g;'
>
> -=--===---===---===---===-=-
> |Mike Szumlinski           |
> |Michigan State University |
> -=--===---===---===---===-=-
> "I need a job. Hire me"
>
>
> _______________________________________________
> linux-user mailing list
> linux-user@egr.msu.edu
> http://www.egr.msu.edu/mailman/listinfo/linux-user
>