Build precise queries to find exactly what you need
Press ESC to close
@p-thor
Member Since: July 24, 2014
Favorites0
Views
Projects0
I really like the regex of it all. Searches most things. But I have found that when the host alias is missing it does not work properly. Also the search does a grep -A INT so if the configuration is less default and places the grep'ed variable outside of the lookahead it will fail also. example: grep -EA2 "define[ ]+host[ ]+" /path/to/objects.cache | grep -Eo "(host_name|alias).+" if alias is on position 3+ it will miss it. Perhaps first grep all the required parameters and then split the ones you want. Something like below. example: grep "(host_name|alias|define[ ]+host[ ]+).+" |grep -EA2 "define[ ]+host[ ]+" /path/to/objects.cache | grep -Eo "(host_name|alias).+"
Reviewed 9 years ago
This works well espexially because it has perf data. I only had to change a minor thing becaus eit matched the wrong line due to matching grep. if you grep "something" it would match "not-something" as well. so i changed: my @line = grep(/$proxy,BACKEND,/, @csv); to: my @line = grep(/^$proxy,BACKEND,/, @csv); regards, Peter
Reviewed 11 years ago