![]() For more regular use, I’d take the winning regex and build it into the Python code. I could then easily read the data into some quick Python code or an Excel spreadsheet. Some egrep CLI work let me quickly remove a lot of junk from ASA firewall flow data, getting it down to the format. (And Undo is your friend when you’re trying to get the regex right!)įor instance, as you might have noticed (prior blogs), I’ve been fiddling with DNS lookups and flow data. (Been a while since I did Notepad++ though.) Regex patterns are amazing for transforming text data. Notepad++ on Windows, SublimeText on Mac are the ones I’m familiar with. Very useful if you’re processing (parsing) show output or almost anything else.Ĥ) Regex-aware editors. Doing so allows you to run some useful tools as well, like a fast multi-address ping tool.ģ) Programming. So with minimal effort, you can jazz up your Windows CLI. Apparently with Windows 10, you needed the Pro version to install WSL. Didn’t you? Well, the WSL (Windows Subsystem for Linux) isn’t hard to install, and I’ve read that the latest version of Windows includes the Linux by default (I see online that it has to be enabled). Ok, that’s a rather basic example – but with egrep you could match on a regex, and the filename wildcard could be fancier.Ģ) You just thought “but I run Windows”. I have a folder of show output (including show run) from a customer, and I did “grep ‘ip address 100.101.102.103’ results/*” while troubleshooting using traceroutes. Just last week, I used them to look up IP addresses. Or change all file names in a folder to pure lower case. In Mac or Linux systems, you can do all sorts of mad things with regexes on the command line. I’ve seen some really long ugly ones lately, and I personally draw the line when the obscurity level gets too great. You’ll quickly learn to spot problems a short/simple regex can help with, and as your skills build, you can do fancier ones. Then when you have a task they might help with, you can expend a little time fiddling to see if you can come up with a regex that fits. So the key initial skill is understanding where a regex might help you. But if you learn a little and start trying to use them, they can be helpful in the job, and you can start building more serious regex skills. They may not be something you want to poke a big hole into your certification plans for. Regexes aren’t something someone new to networking (aka “newbie”) needs to deal with. However, I claim regular expressions are something it behooves network engineers to start learning and working with at some point. (And I’ll grant the head hurt thing has happened to me a few times over the years.) ![]() I suspect regular expressions are something some/many of us either don’t know much about, or, for those who do know about them, we consider regexes painful. TL DR: Plug for learning how to use regular expressions, incrementally. I hope your reaction to my title isn’t “WTF?”.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |