Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations SSS148 on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problems with GREP in Linux (Redhat 8.0)

Status
Not open for further replies.

robthomas

Computer
Mar 9, 2003
1
I am trying to come up with the correct GREP syntax that gives me all the words, in the file (testgrep) below, that start with the letter 'l'. The test file I have is

long time ago
I lived free
In the Hinterland

1. If I run grep l testgrep I get............all the lines (as expected)
2. If I run grep ' l' testgrep I get............I lived free (as expected)
3. If I run grep '^l' testgrep I get............long time ago

With the grep 3. (see above) I would have expected I lived free
As lived starts with an 'l'.

I have tried running ['^l',' l'] to match on both expressions but this only gives all the lines in the file.

I suspect I am missing something cricial, can anyone help.

Thanks in advance
Rob Thomas

 
Replies continue below

Recommended for you

Status
Not open for further replies.

Part and Inventory Search

Sponsor