![]() |
|
|
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 |
| How To replace Control-M in all files in a folder | padpa | Shell Programming and Scripting | 10 | 09-02-2008 07:58 AM |
| Replace a string containing :/=\ in files | lalelle | Shell Programming and Scripting | 4 | 08-14-2008 09:26 AM |
| How to learn the number of files under a particular folder, containing subfolders | cy163 | UNIX for Dummies Questions & Answers | 5 | 09-01-2007 11:55 AM |
| Basic Q: getting list of all files of type within folder & subfolders | AtomicPenguin | UNIX for Dummies Questions & Answers | 1 | 07-28-2007 07:43 AM |
| Need to replace a string in 100's of files | calredd | Shell Programming and Scripting | 3 | 03-21-2007 05:14 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Replace string in all files in a folder and subfolders.
i need to change string in all files in current folder and all subfolders. i wrote the following script. It works good except it dont delete temp file from subfolders.
for z in `find . -type f -name "*.html" -o -name "*.htm"`; do sed -e 's@abc@xyz@g' $z>temp; mv temp $z; done any idea? or any other better solution? |
|
||||
|
Quote:
need some more guidence i also need to make changes according to file types like this Code:
for z in `find . -type f -name "*.PHP"`; do sed -e 's@123@456@g' $z>temp; mv temp $z && rm temp; done for z in `find . -type f -name "*.html" -o -name "*.htm"`; do sed -e 's@abc@xyz@g' $z>temp; mv temp $z && rm temp; done any other better way to do this instead of using 2 loops? |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|