Skip to content

Instantly share code, notes, and snippets.

@hatappo
Last active December 19, 2015 16:08
Show Gist options
  • Save hatappo/5980972 to your computer and use it in GitHub Desktop.
Save hatappo/5980972 to your computer and use it in GitHub Desktop.
# awk. Default delimiter is blank character with the longest match.
echo 'a b c' | awk '{print $1 " " $2 " " $3 " " $4}'
#=> a b c
# cut. Default delimiter is a single blank charcter.
echo 'a b c' | cut -f1,2,3,4
#=> a b c
# awk. Delimiter option is "-F"
echo 'a b c' | awk -F" " '{print $1 " " $2 " " $3 " " $4}'
#=> a b c
# cut. Delimiter option is "-d".
echo 'a b c' | cut -d" " -f1,2,3,4
#=> a b c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment