The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



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
rsh to change multiple ip in multiple servers? kenshinhimura Shell Programming and Scripting 2 02-18-2008 03:04 AM
How to make ulimit change permanent nervous UNIX for Dummies Questions & Answers 3 08-25-2007 01:28 AM
find all scripts to change DNS name?? Bhups Shell Programming and Scripting 0 06-29-2006 01:39 AM
is there any way to make flat file from some of scripts ? umen Shell Programming and Scripting 0 02-18-2006 05:42 PM
Regarding Make Scripts S.Vishwanath UNIX for Dummies Questions & Answers 5 08-15-2001 02:36 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 08-07-2002
rdakhan rdakhan is offline
Registered User
  
 

Join Date: Aug 2002
Posts: 1
Red face How to make the same change in multiple shell scripts?

I would like to make the same change in multiple shell script files and would like to know if anyone can be of some help? I would appreciate it.
  #2 (permalink)  
Old 08-07-2002
FIRE FIRE is offline
Registered User
  
 

Join Date: Jul 2002
Location: South of Holland
Posts: 10
What do you want to change in the script, programming code or only variables?

If you want to change variables you can put these in a file. You read these variables by using commands like grep and awk print.
  #3 (permalink)  
Old 08-10-2002
jiin jiin is offline
Registered User
  
 

Join Date: Oct 2001
Location: Atlanta
Posts: 9
If I understand you correctly you want to change one specific regex in a script to another. you can use sed to do global substitutions.

sed -e s/foo/bar

Build a list file with
ls > listfile and edit it. Then:

listfile=/path/to/listfile
for i in $listfile
do
sed -e s/foo/bar $i
done
echo Return Code: $?


The echo at the bottom will return a 0 or a 1 .. 0 if successfull and 1 if it fails.

jiin
  #4 (permalink)  
Old 05-29-2007
rajx rajx is offline
Registered User
  
 

Join Date: May 2007
Posts: 4
Same Changes to multiple Scripts

you use following script

for file in $*
do
sed 's/string/string1/g' $file>,$file
mv ,$file $file
done

i hope this will help u
  #5 (permalink)  
Old 05-29-2007
ghostdog74 ghostdog74 is offline Forum Advisor  
Registered User
  
 

Join Date: Sep 2006
Posts: 2,507
if you have gnu sd
Code:
sed -i 's/string/string1/g' file*
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 12:54 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0