![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Search, replace string in file1 with string from (lookup table) file2? | gstuart | Shell Programming and Scripting | 9 | 06-08-2009 07:11 AM |
| shell script to find and replace string in multiple files | pharos467 | Shell Programming and Scripting | 11 | 01-15-2009 11:40 AM |
| Replace a string containing :/=\ in files | lalelle | Shell Programming and Scripting | 4 | 08-14-2008 09:26 AM |
| find and replace string in a directory files | koti_rama | Shell Programming and Scripting | 2 | 05-30-2008 04:48 AM |
| Find and replace a string in multiple files | pharos467 | UNIX for Dummies Questions & Answers | 2 | 11-05-2007 11:47 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Need to replace a string in 100's of files
Hi,
I have to parse 100's of files in a loop and replace a word called boston with a new word miami. I have to use korn shell scripting and I know grep, awk and also the looping part but I am not able to figure out how to implement the string replace part. I can vi each and every file but I want to automate this in a ksh using for loop. Appreciate your responces. Thanks Carl ex: From: cat file1.dat city name is boston and country is USA. To: cat file1.dat city name is miami and country is USA. Like file1.dat, I have 100's of files in which I have to do string replace and preserve the same file name. |
|
||||
|
But why do you need 'cat' and 'pipe' if sed can accept a file as argument.?? And still the sed 's output can be redirected to create a new file
Example: PHP Code:
Nagarajan Ganesan |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|