v5 Initial Config: Find/Replace String All Files (OS X)

The following command will change the interface type in the text files, or any other string in the files.

I downloaded the folder and ran the following command from terminal to change all the interfaces from GigabitEthernet1 to FastEthernet0/0 in all the text files in all the subfolders. Run the command from ine.ccie.rsv5.workbook.initial.configs directory in the file system. Hopefully this saves you some time.

 

sed -i "" -e  "s/GigabitEthernet1/FastEthernet0//"g ./*/*.txt

                        ^find^             ^replace with^

 

FastEthernet0// = FastEthernet0/0

Comments

  • I want GigabitEthernet to turn into Ethernet0/
    I tried different variables but it did not work, could you please tell me the command I need?

    cd /Users/matbutch/Desktop/ine.ccie.rsv5.workbook.initial.configs

    sed -i "" -e  "s/GigabitEthernet/Ethernet0/"g ./*/*.txt

    sed: 1: "s/GigabitEthernet/Ether ...": unescaped newline inside substitute pattern

     

    The outcome would be like:

    Ethernet0/1   
    Ethernet0/1.13
    Ethernet0/1.100
    Ethernet0/1.146

     

    Thanks for your time!!

  • Hi,

    You can use Notepad++ in Windows for such a task, it can replace from folders, so I guess this is what you need.

Sign In or Register to comment.