Created
July 18, 2012 20:22
-
-
Save clifferson/3138612 to your computer and use it in GitHub Desktop.
Make awk do some grep
This file contains 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
If you want to search field one for (part of) a string: | |
awk '$1 ~ /search string/ { print $2 }' example.txt | |
If the search string should match anywhere in the line (all fields): | |
awk '/search string/ { print $2 }' example.txt | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment