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

search and replace in a file 1

Status
Not open for further replies.

dwcasey

MIS
Oct 31, 2002
179
US
This works fine...it searches onconfig and looks for
LTAPEDEV /dev/infmx/log_tape_dev

And replaces with
LTAPEDEV /dummy

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

What can I do so that if there is extra spaces ( white space ) between LTAPEDEV and /dummy and make sure the search/replace still works?
 
you mean "and /dev", as /dummy is on the right side of the replacement:

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

- Miller
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top