logoalt Hacker News

rethab • yesterday at 1:49 PM • 1 reply • view on HN

Wonderful AWK command there. For those with hobbies other than AWK, here's what it does:

  - set variable s to that string: -v s='=== /C=IN/OU=emSign PKI/O=eMudhra Technologies Limited/CN=emSign ECC Root CA - G3'
  - on lines matching the regex between //, set skip to false: /^(===|###) /{skip=0}
  - on lines matching s, set skip to true: $0==s{skip=1}
  - if skip is false, print the line: !skip
Note the last part where it just says !skip without a curly braces. AWK defaults to print in that case.

Replies

tomjakubowski • yesterday at 6:21 PM

AWK is a great hobby, if anyone's looking to get into a new one. If sed is map and grep is filter, then awk is reduce.

➕ show 1 reply