|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | 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. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
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? |
| Sponsored Links | ||
|
|
#2
|
|||
|
|||
|
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? |
| Sponsored Links | ||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| unique words in files of folder and its subfolders | Dworza | Homework & Coursework Questions | 9 | 03-14-2011 03:24 AM |
| How to obtain a count of files in a folder and it's subfolders | scarfinv | UNIX for Dummies Questions & Answers | 2 | 10-29-2010 03:16 PM |
| Shell script delete log files from folder & subfolders on space usage | saha | Shell Programming and Scripting | 3 | 03-22-2009 10:56 PM |
| How to learn the number of files under a particular folder, containing subfolders | cy163 | UNIX for Dummies Questions & Answers | 5 | 09-01-2007 10:55 AM |
| Basic Q: getting list of all files of type within folder & subfolders | AtomicPenguin | UNIX for Dummies Questions & Answers | 1 | 07-28-2007 06:43 AM |
|
|