725 B
725 B
cut
-
séparateur par défaut: TAB
-
sinon option -d ' '
# -d (delimiter) :
# -f (field) 1
$ cut -d':' -f1 /etc/passwd
nobody
root
daemon
_uucp
_taskgated
_networkd
cut -d':' -f1-3,5,6 /etc/passwd
# Tout sauf 7e champ
$ cut -d':' -f7 --complement /etc/passwd
# Remplace le séparateur ':' par ' '
$ cut -d':' -f7 --complement /etc/passwd --output-delimiter=' '
# 5e caractère
$ echo 'cut command' | cut -b 5
c
# 5 au 7e caractères
$ echo 'cut command' | cut -b 5-7
com
# 5 et 7e caractères
$ echo 'cut command' | cut -b 5,7
cm
# Du 5e à la fin
$ echo 'cut command' | cut -b 5-
command
# Du début au 5e
$ echo 'cut command' | cut -b -5
cut c