Skip to content

Instantly share code, notes, and snippets.

@draftcode
Created December 13, 2013 12:33
Show Gist options
  • Save draftcode/7943595 to your computer and use it in GitHub Desktop.
Save draftcode/7943595 to your computer and use it in GitHub Desktop.
#!/usr/bin/gawk -f
# $ echo 'a[1] = b[1]' | ./test.awk pattern='.\\[[[:digit:]]\\]'
# a[1]
# b[1]
{
s = $0
while (match(s, pattern)) {
print substr(s, RSTART, RLENGTH)
s = substr(s, RSTART+RLENGTH)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment