regex scratchpad

From thelinuxwiki
Jump to: navigation, search

grep for pattern of startof line, numbers, spaces, word Any

# cat firewall_policy.txt | grep -E "^[0-9]* *Any" 

print firewall text rules between #..spaces...Any and the end of rule ----------\

# cat firewall_policy.txt | sed -n -e '/^[0-9]* *Any/,/--------------------/ p'