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.
Find/Replace in subdirectories
Name: vasur Date: June 20, 2003 at 07:20:44 Pacific OS: Solaris CPU/Ram: 1GB
Comment:
Hi, I have the following script that finds and replaces a given string pattern in all files within the directory it is executed. What change does it require so it can do the same in all the subdirectories. Thanks, Vasu.
#!/bin/ksh #Loop through every file like this for file in *.htm* do cat $file | sed "s/johhn/John/g" > $file.new #do a global search and replace and put the results in $file.new mv $file.new $file #rename $file.new to original name of file done
Summary: I saw a reference to using vim, but if I understood it correctly, I would still have to manually process each file (ie. load the file in vim, issue edit commands, load next file, etc...). As there...
Summary: dear all, how to find files in the specific date. I usually use this syntax : find -ctime +n / -n ( day) if I used this file, I still have to count the diference days between today and that specific ...
Summary: Hi, I need to pick up files older than 5 days and then do something (move them, actually). This works fine with the find command. However i do NOT want to look in the subdirectories - how can i preven...