Re: [gentoo-user] Need help with a regex

2008-05-24 Thread Wolf Canis
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Robin Atwood wrote: >grep -e ^\s+provide\s+\w /etc/init.d > > but, as usual, nothing is matched. What am I doing wrong? You have to use back slashed versions of meta characters. Following how would do that: $ grep -e '^[[:space:]]\+provide[[

Re: [gentoo-user] Need help with a regex

2008-05-24 Thread Alan McKinnon
On Saturday 24 May 2008, Robin Atwood wrote: > On Saturday 24 May 2008, Alan McKinnon wrote: > > On Saturday 24 May 2008, Robin Atwood wrote: > > > But why does "[[:space:]]+" work and "\s+" fail? > > > > Apparently because \s is not a synonym for [[:space:]] > > Here for a start: > http://www.regu

Re: [gentoo-user] Need help with a regex

2008-05-24 Thread Robin Atwood
On Saturday 24 May 2008, Alan McKinnon wrote: > On Saturday 24 May 2008, Robin Atwood wrote: > > But why does "[[:space:]]+" work and "\s+" fail? > > Apparently because \s is not a synonym for [[:space:]] > Here for a start: http://www.regular-expressions.info/charclass.html#shorthand and also ht

Re: [gentoo-user] Need help with a regex

2008-05-24 Thread Wolf Canis
Robin Atwood wrote: >grep -e ^\s+provide\s+\w /etc/init.d > > but, as usual, nothing is matched. What am I doing wrong? You have to use back slashed versions of metacharacters. Following how would do that: $ grep -e '^[[:space:]]\+provide[[:space:]]\+[a-z]\+' /etc/init.d/* /etc/init.d/sy

Re: [gentoo-user] Need help with a regex

2008-05-24 Thread Alan McKinnon
On Saturday 24 May 2008, Robin Atwood wrote: > But why does "[[:space:]]+" work and "\s+" fail? Apparently because \s is not a synonym for [[:space:]] I've heard this one before but never got it to work and never seen it in writing. Do you have a reference for where you read it? -- Alan McKinn

Re: [gentoo-user] Need help with a regex

2008-05-24 Thread Robin Atwood
On Saturday 24 May 2008, Alan McKinnon wrote: > "grep -e" is not the same thing as "egrep" or "grep -E", and > I never managed to get \s to work as a synonym for [[:space:]] I was wondering about that! > Plus you need a proper file glob i your file spec That was a typo in my post. > Try: > egre

Re: [gentoo-user] Need help with a regex

2008-05-24 Thread Robin Atwood
On Saturday 24 May 2008, Etaoin Shrdlu wrote: > On Saturday 24 May 2008, 17:22, Robin Atwood wrote: > > Regexs are not my strong point! I am trying to get a list of service > > scripts that provide virtual services. Each such script contains a > > line like: > > > > provide dns > > > > i.e. the

Re: [gentoo-user] Need help with a regex

2008-05-24 Thread Alan McKinnon
On Saturday 24 May 2008, Robin Atwood wrote: > Regexs are not my strong point! I am trying to get a list of service > scripts that provide virtual services. Each such script contains a > line like: > > provide dns > > i.e. the line starts with one or more spaces, followed by the text > "provi

Re: [gentoo-user] Need help with a regex

2008-05-24 Thread Robin Atwood
On Saturday 24 May 2008, Andrey Falko wrote: > On Sat, May 24, 2008 at 11:32 AM, Andrey Falko <[EMAIL PROTECTED]> wrote: > > On Sat, May 24, 2008 at 11:22 AM, Robin Atwood > > > > <[EMAIL PROTECTED]> wrote: > >> Regexs are not my strong point! I am trying to get a list of service > >> scripts that

Re: [gentoo-user] Need help with a regex

2008-05-24 Thread Etaoin Shrdlu
On Saturday 24 May 2008, 17:22, Robin Atwood wrote: > Regexs are not my strong point! I am trying to get a list of service > scripts that provide virtual services. Each such script contains a > line like: > > provide dns > > i.e. the line starts with one or more spaces, followed by the text

Re: [gentoo-user] Need help with a regex

2008-05-24 Thread Andrey Falko
On Sat, May 24, 2008 at 11:32 AM, Andrey Falko <[EMAIL PROTECTED]> wrote: > On Sat, May 24, 2008 at 11:22 AM, Robin Atwood > <[EMAIL PROTECTED]> wrote: >> Regexs are not my strong point! I am trying to get a list of service scripts >> that provide virtual services. Each such script contains a line

Re: [gentoo-user] Need help with a regex

2008-05-24 Thread Andrey Falko
On Sat, May 24, 2008 at 11:22 AM, Robin Atwood <[EMAIL PROTECTED]> wrote: > Regexs are not my strong point! I am trying to get a list of service scripts > that provide virtual services. Each such script contains a line like: > >provide dns > > i.e. the line starts with one or more spaces, f

[gentoo-user] Need help with a regex

2008-05-24 Thread Robin Atwood
Regexs are not my strong point! I am trying to get a list of service scripts that provide virtual services. Each such script contains a line like: provide dns i.e. the line starts with one or more spaces, followed by the text "provide", followed by one or more spaces and a single word.