Computing.Net > Forums > Unix > Shell script to replace a string

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Shell script to replace a string

Reply to Message Icon

Name: sandeeprk
Date: May 7, 2003 at 03:37:32 Pacific
OS: HP-UX
CPU/Ram: p2
Comment:

hello all,
I have a file which has a string as follows:-

bin

i want 2 write a shell script which will replace this by /home/sandeep/bin. This should be interactive if possible.
Sorry if it is 2ooo trivial a question.
thanx in advance
sandeep



Sponsored Link
Ads by Google

Response Number 1
Name: David Perry
Date: May 7, 2003 at 04:29:28 Pacific
Reply:

sed works nicely for string replacements.

sed -e 's,bin,/home/sandeep/bin,' filename


0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: Shell script to replace a string

shell script for string search www.computing.net/answers/unix/shell-script-for-string-search/5478.html

script to check a dynamic ip www.computing.net/answers/unix/script-to-check-a-dynamic-ip/6456.html

I need a shell-script to search www.computing.net/answers/unix/i-need-a-shellscript-to-search/5941.html