Jim,

 

This is a tutorial for using SED.  It is just a command in Unix for search
and replace within a file without having to open the file.

http://www.grymoire.com/Unix/Sed.html

 

But a really quick example is following

Let's say I want to replace FastEthernet0/1 - 0/24 with FastEthernet1/0/1 -
1/0/24.

And I want to replace this in every Cat2.txt File in the configuration
folder

I may have the following folder directory

LAB-1/INITIAL/Cat2.txt

LAB-1/FINAL/Cat2.txt

LAB-2/INITIAL/Cat2.txt

LAB-2/FINAL/Cat2.txt

LAB-3/INITIAL/Cat2.txt

LAB-3/FINAL/Cat2.txt

 

I could use the following command to make the replacement.  (One note: the /
is a special character so I have to escape it before typing it in.)

sed 's/ FastEthernet 0\//FastEthernet1\/0\//g' -I LAB-*/*/Cat2.txt

 

Or if I wanted to replace Serial0/1/0 with Serial0/1 in every file I could
do

sed 's/Serial0\/1\/0/Serial0\/1/g' -I LAB-*/*/*

 

Or a more basic of not having to escape the special character above replace
fi with foo

sed 's/fi/foo/g' -I LAB-1/INITIAL/R1.txt

 

The s/ is for search and replace

-I is replace inline in file

/g is do it globally

 

sed 's/<find string>/<replace with>/g' -I <file or file location>

 

 

Regards,

 

Tyson Scott - CCIE #13513 R&S, Security, and SP

Technical Instructor - IPexpert, Inc.


Telephone: +1.810.326.1444 
Cell: +1.248.504.7309
Fax: +1.810.454.0130
Mailto:  [email protected]

 

Join our free online support and peer group communities:
<http://www.ipexpert.com/communities> http://www.IPexpert.com/communities

 

IPexpert - The Global Leader in Self-Study, Classroom-Based, Video On Demand
and Audio Certification Training Tools for the Cisco CCIE R&S Lab, CCIE
Security Lab, CCIE Service Provider Lab , CCIE Voice Lab and CCIE Storage
Lab Certifications.

 

From: Jim McBurnett [mailto:[email protected]] 
Sent: Thursday, October 22, 2009 3:14 PM
To: [email protected]
Subject: ZED?

 

Tyson,

Can you provide a link for ZED?

 

 

 

Thanks,

 

 

Jim McBurnett

Senior Network Engineer

CCNP,CCVP, CCDA

Thomas Glover Associates, Inc.

864-473-1200 x 106 office

864-641-5863 Cell

ccvp_voice_smCCNP_smccda_sm

 

<<image001.jpg>>

<<image002.jpg>>

<<image003.jpg>>

_______________________________________________
For more information regarding industry leading CCIE Lab training, please visit 
www.ipexpert.com

Reply via email to