Created
August 1, 2020 16:34
-
-
Save packetchef/00172ba64a121b61b276607e45dfc59d to your computer and use it in GitHub Desktop.
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
# How many characters per line? | |
$ awk '{ print length($0) }' | |
# How many words per line? Add -F for separator | |
awk '{ print NF }' | |
# How do I see a substring? Example, 4 characters starting at position 2 | |
$ awk '{ print substr($0, 2, 4) }' | |
# Alternative to the above, use cut: | |
$ cut -c2-4 | |
# Where is my substring? | |
$ awk '{ print index($0, "string") }' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment