5 examples for cut
# To parse the word sir (using the ' ' as a delimeter, the choosing the second word)
echo "hello sir" | cut -d' ' -f2
# use `col` to format an output so you can select the third string using the default tab as a delimeter
who | col | cut -f3
# Example 4 has used the program "col" for setting tabs as field
# delimiters. Not bad, but there is another way to do it with the
# stream editor "sed".
who | sed -E 's/ {2,}/\t/g' | cut -f3
# You can compare the results, the way the tabs are set using either
# col or sed, with the following two commands.
who | col | od -a
who | sed -E 's/ {2,}/\t/g' | od -a
# Extraer un fragmento de un archivo
cut -d: -f1 /etc/passwd
# Extraer un fragmento de un archivo y ordenarlo de forma inversa
cut -d: -f1 /etc/passwd | sort -r