Last active
January 3, 2016 12:49
-
-
Save jc00ke/8465534 to your computer and use it in GitHub Desktop.
Awks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$> ag FOO some_file | awk 'split($0, a, "\"") { print $2, $3 }' | |
FOO_WIDGET_COUNT=1 | |
FOO_WIDGET_NAME="Black Jack Johnson" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export FOO_WIDGET_COUNT=1 | |
export FOO_WIDGET_NAME="Black Jack Johnson" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
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