Skip to content

Instantly share code, notes, and snippets.

@jc00ke
Last active January 3, 2016 12:49
Show Gist options
  • Save jc00ke/8465534 to your computer and use it in GitHub Desktop.
Save jc00ke/8465534 to your computer and use it in GitHub Desktop.
Awks
$> ag FOO some_file | awk 'split($0, a, "\"") { print $2, $3 }'
FOO_WIDGET_COUNT=1
FOO_WIDGET_NAME="Black Jack Johnson"
export FOO_WIDGET_COUNT=1
export FOO_WIDGET_NAME="Black Jack Johnson"
{
split($0, a, "\"")
$2 = a[2]
$3 = $(NF - 1)
$4 = $NF
print "and the fields are ", $1, "+", $2, "+", $3, "+", $4
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment