Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

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

SED Question.

Status
Not open for further replies.
Apr 29, 2001
1
GB
I'm looking for a way to get sed to look for string and only that string i.e to find "or" but not "for" or "organise" or "fore" etc. I know that with grep you can use '-w' to search for whole words, but I can't find anyway of doing this with sed, can anyone help?
 

Hello, charlie1105!

If you must find only word "or", you can use this regular expression:

/ or / || /$or / || / or$/

First regular expression finds whole word "or". Second - "or" at the beginning of the line. Third - at the end of line.

But this won't find this pattern: or.

HTH. Bye!

KP.
 

Sorry, charlie1105!

I did little mistake. This is correct regExp that also match "or.":

/ or[ .]/ || /^or / || / or$/

Bye!

KP.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top