Guest User

Untitled

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