Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more

Go Back   Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more > Linux Operating System > Programming / Scripts
User Name
Password

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 10-06-2005, 06:54 PM   #1 (permalink)
ez2c
Member
 
Join Date: Aug 2005
Location: Texas
Posts: 40
Default find and replace shell script

Hi,

Looking for some tips on how to build a find and replace shell script I can use to mass modify my named.conf file. I need to change out an ip address in over a hundred places in the file.

Okay I start like this: for fl in named.conf but then what?

tia
ez2c is offline   Reply With Quote
Sponsored Links
Old 10-06-2005, 08:15 PM   #2 (permalink)
taylor
Junior Member
 
Join Date: Aug 2005
Posts: 28
Default

On the fly here ~ so use caution - example current ip is 72.96.52.127 and your named.conf file resides in the etc directory.

Code:
#!/bin/sh # you must be root to run this script # Lets store some user input to variables echo "" cd /etc echo "Enter your new ip address" read var1 echo "I've logged your ip addy $var1" for fl in named.conf; do mv $fl $fl.old sed "s/72.96.52.127/$var1/g" $fl.old > $fl rm -f $fl.old done echo " ***************************************************************" echo " .... Your file updates are complete" echo " ***************************************************************" exit
taylor is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

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

Points Per Thread View: 1.00
Points Per Thread: 11.00
Points Per Reply: 5.00



» Sponsors

» Links

» Affiliates
Web Hosting
Marketing Find
Merchant Select
SiteMap Builder
Host Compare
Dedicated Servers

» Links

» Sports Network
Paintball Forum
Football Forum
Hockey Forum
Golf Forum
Boxing Forum
Lacrosse Forum
Baseball Forum
SnowBoarding Forum
Soccer Forum
MMA Forum


All times are GMT -4. The time now is 11:24 PM.



LinkBacks Enabled by vBSEO 3.0.0 RC8
Webmaster Forums