sh help


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting sh help
# 1  
Old 05-05-2011
sh help

I have command like this:

Code:
find . -exec grep -q ""/opt/dba/perl-5.8.8" '{}' \; -print

this will print files with the above string . I want to replace that string with
/opt/dba/112_perl/perl-5.8.8 ( instaed of printing ) . can I do this in same command or need seperate script ?

Thanks
# 2  
Old 05-05-2011
Quote:
Originally Posted by talashil
I have command like this:

Code:
find . -exec grep -q ""/opt/dba/perl-5.8.8" '{}' \; -print

this will print files with the above string . I want to replace that string with
/opt/dba/112_perl/perl-5.8.8 ( instaed of printing ) . can I do this in same command or need seperate script ?

Thanks
If i understand right you can use SED to replace strings:

Code:
sed '/\/opt\/dba\/perl-5.8.8/s/perl-5.8.8/112_perl\/perl-5.8.8/g' INFILE

Backslashes used to escape slashes, you can also use another seperator like #, or tilde etc.

Regards
Login or Register to Ask a Question

Previous Thread | Next Thread
Login or Register to Ask a Question