Computing.Net > Forums > Unix > unix script - find and replace

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.

unix script - find and replace

Reply to Message Icon

Name: amir
Date: December 3, 2003 at 23:08:43 Pacific
OS: UNIX - Solaris
CPU/Ram: Sun, ultra10
Comment:

Hi all,

I have a lot of similar files that i have to update.
I need an unix script that scan all these file, looking for old templet and replace it with new one.

for example:
I have two similar files, file#1 .ex and file#2.ex
i need a scrip that scan these two flies and will replace 0101 templet with 1010 11 templet.

Old files:

file#1 .ex
0000
0101
1001

file#2 .ex
0000
0101
1111

New files:

file#1 .ex
0000
1010 11
1001

file#2 .ex
0000
1010 11
1111

Tanks,
Amir



Sponsored Link
Ads by Google

Response Number 1
Name: David Perry
Date: December 4, 2003 at 05:49:35 Pacific
Reply:

Have you tried sed?

sed -e 's/0101/1010 11/' oldfile > newfile


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: unix script - find and replace

One more Q. (find and replace) www.computing.net/answers/unix/one-more-q-find-and-replace/5826.html

Need help with a search and replace logi www.computing.net/answers/unix/need-help-with-a-search-and-replace-logi/3296.html

Find and replace directories www.computing.net/answers/unix/find-and-replace-directories/7816.html