Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (10:52:48) Dan: know what would be cool?
- (10:53:00) Dan: a stateful sed/grep tool (or wrapper around them)
- (10:53:20) Dan: so i dont have to mess with awk and such
- (10:53:21) Dan: something like this:
- <old state>: <regex 1> <new state>
- <new state>: <regex 2>//
- <new state>: <regex 3> <old state>
- (10:53:42) Dan: example, something ive wanted to do recently, i had text like this:
- INFO: some log info
- DEBUG: some log debug
- INFO: Hex dump:
- 0001 0A0B0100 0A0B0100 0A0B0100 ..........
- 0002 0A0B0100 0A0B0100 0A0B0100 ..........
- 0003 0A0B0100 0A0B0100 0A0B0100 ..........
- INFO: some log info
- (10:53:53) Dan: I wanted to sanitize the output, so for example: 0001 0A0B0100 0A0B0100 0A0B0100 .......... would become 0001 <removed>
- (10:54:03) Dan: If i had a stateful regex tool, I could do this:
- (10:54:09) Dan:
- s1: "^INFO: Hex dump:$" s2
- s2: " ([0-9A-F]{8} ){3}\.+$"/<removed>/
- s2: "^$" s1
Add Comment
Please, Sign In to add comment