Re: Regular expression with egrep question...



On Jan 4, 7:31 am, somebody <s...@xxxxxxxx> wrote:
Why will this regex match lines in myfile.txt which begin with a space:

egrep '^\ ' myfile.txt

And this one does not:

egrep '^\s+' myfile.txt

I thought tat the \s is space, and the + denotes more than one?
I tried using the -e switch to egrep too. Essentially I'm simply
trying to match lines like this:

Line one
Line two
Line three
Line four

-Thanks

maybe i am missing something..

sed -n "/^ /p" file
.



Relevant Pages

  • Re: Regular expression with egrep question...
    ... egrep '^\s+' myfile.txt ... I thought tat the \s is space, and the + denotes more than one? ... *grep for finding patterns in files anyway though. ...
    (comp.unix.shell)
  • Solaris 10 NAT
    ... -bash-3.00$ svcs -a | egrep ip ... What's missing? ... Fabio Andres Miranda ... Ingenieria de sistemas informaticos ...
    (SunManagers)
  • Re: [opensuse] locate ?
    ... Is it ok or am I missing anything? ... You probably forgot to install it. ... % rpm -qa |egrep locate ...
    (SuSE)
  • Regular expression with egrep question...
    ... Why will this regex match lines in myfile.txt which begin with a space: ... egrep '^\s+' myfile.txt ... I thought tat the \s is space, and the + denotes more than one? ... I tried using the -e switch to egrep too. ...
    (comp.unix.shell)