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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

grep with spaces

Status
Not open for further replies.

dwcasey

MIS
Oct 31, 2002
179
0
0
US
Is there a grep equivalent to the following perl search/replace?

perl -pi -e 's{LTAPEDEV\s+/dev/infmx/log_tape_dev}{LTAPE /dummy}g' onconfig

Not necessarily the search/replace, but searching for something like:

LTAPEDEV /dev/infmx/log_tap_dev
LTAPEDEV /dev/infmx/log_tap_dev

So a grep where I could essentially
grep+LTAPEDEV /dev/infmx/log_tap_dev

and get either of the above regardless of spaces.
 
Code:
egrep "LTAPEDEV[[:space+]]/dev/infmx/log_tap_dev" onconfig
egrep is the key to this.

On the internet no one knows you're a dog

Columb Healy
 
grep -E 'LTAPEDEV[[:blank:]]+/dev/infmx/log_tap_dev' onconfig

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
this is on AIX...weird, I'm getting []imbalance ??

but I found that I can grep "LTAPEDEV */dev/infmx/log_tap_dev" onconfig and get the results I needed.
 
My egrep solution was tested on AIX 5.1 ML7 and works fine. I also test PHV's solution and it worked.

Ooops! :-( There's a typo in transposition - my solution should be
Code:
egrep "LTAPEDEV[[:space:]]+/dev/infmx/log_tap_dev" onconfig

On the internet no one knows you're a dog

Columb Healy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top