Text Tools–Take 1 (6 of 30)

I have been a fan of Text Mechanic a site uses javascript to perform a bunch of actions on a given set of text. What is nice about it being javascript is everything is within browser. However it doesn’t meet all my needs. I have started to create some text tools of my own, but I am doing it in Perl, so please note that the configlets are seen by my server, and though I have no intention of logging them, I am not responsible for them either 🙂 I plan on releasing this and more on github, so stay tuned.

I haven’t figured out how to integrate jquery into wordpress ( nor am I that familiar with jquery) to make this an integrated script, I can host it on a plain webpage. This first take is pretty simple, it takes find replace on the left text area, that you separate by comma, and changes the configlet on the right with a simple find and replace. The nice thing is you can have overlapping find replaces, meaning you can have “GigabitEthernet1/0/1,Ethernet109/1/1” and “Ethernet109/1/2,GigabitEthernet1/0/1” and correctly output it. It does this by passing through twice, the first time replacing it with a random created text, and then replacing the random text with the new one. It will make more sense in the example.

The example and the notes on the webpage say interfaces, but in reality it can be anything, though it might trip up on some special characters.

Here is the webpage, like I said, more to come, and I will clean it up -> Text Tools

Web Form

Example Input

Interface Changes

interface GigabitEthernet1/0/1
description Cisco_VSS Te1/2/1
switchport access vlan 10
interface Ethernet109/1/2
description Cisco_VSS Te2/2/1
switchport access vlan 20
switchport mode access
switchport nonegotiate
interface GigabitEthernet1/0/3
description Test-Switch02 G1/0/12 Mgmt
switchport access vlan 30
switchport mode access
switchport nonegotiate
interface GigabitEthernet1/0/4
description Test-Switch01 G1/0/12 Mgmt
switchport access vlan 30
switchport mode access
switchport nonegotiate
duplex full

Example Output

Leave a Comment

NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>