Computing.Net > Forums > Unix > Replace string in many files

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.

Replace string in many files

Reply to Message Icon

Name: tspj88
Date: April 29, 2004 at 18:20:43 Pacific
OS: xp
CPU/Ram: 512
Comment:

I need to update the date content in a bunch of files called march1, march2, march4, march5,...., march30, april1, april2,....april28

for P in $1 [# march* --->$1]
do
sed 's/*2002/*2003/g' $1 > $1.tmp
mv $1.tmp $1
done

This script can only handle the march1 but not for all files with march

Can anyone help me?



Sponsored Link
Ads by Google

Response Number 1
Name: tspj88
Date: April 29, 2004 at 18:24:33 Pacific
Reply:

Sorry, the actual script:

for P in $1 [# march* --->$1]
do
sed 's/*2002/*2003/g' $P > $P.tmp
mv $P.tmp $P
done

Can anyone have a suggestion?


0

Response Number 2
Name: Wolfbone
Date: April 29, 2004 at 23:05:55 Pacific
Reply:

Try using $@ instead of $1


0

Sponsored Link
Ads by Google
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: Replace string in many files

change string in multiple file www.computing.net/answers/unix/change-string-in-multiple-file/4697.html

Adding a new string in a file www.computing.net/answers/unix/adding-a-new-string-in-a-file/8060.html

Search and replace string in files www.computing.net/answers/unix/search-and-replace-string-in-files/7857.html