Skip to content

Instantly share code, notes, and snippets.

@fprimex
Created January 19, 2015 20:56
Show Gist options
  • Save fprimex/8bf4515d27247a5cdb7c to your computer and use it in GitHub Desktop.
Save fprimex/8bf4515d27247a5cdb7c to your computer and use it in GitHub Desktop.
Demonstrate AWK bug on OS X.
BEGIN {
string1 = "[couchdb:info,2014-04-22T22:30:04.873,ns_1@node:<0.6548.6>:couch_log:info:39]164.55.92.41 - - GET /default/_design/v6/_view/v6_sizes?group=true&group_level=1 500"
string2 = "[couchdb:info,2014-06-15T6:30:06.928,ns_1@node:<0.3037.5064>:couch_log:info:39]164.55.92.41 - - GET /default/_design/v6/_view/v6_sizes?group=true&group_level=1 200"
match(string1, /_view\/[_[:alnum:]]+/)
view = substr(string1, RSTART, RLENGTH)
print view
match(string2, /_view\/[[:alnum:]_]+/)
view = substr(string2, RSTART, RLENGTH)
print view
}
@fprimex
Copy link
Author

fprimex commented Jan 19, 2015

Output if the bug is present:

$awk -f testawk.awk 
_view/v6_sizes
_view/v6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment