Cut command: Extracts fragments in each line of a file
cut [OPTION] ... [FILE] ...
Description (DESCRIPTION)
The extracted fragments are displayed in standard output in each row of the file.
-B,--bytes=list
Output these bytes
Instance:
[Email protected] ~]# Cat/etc/gshadow |cut-b 1-5
Root
Bin::
Daemo
SYS::
Adm::
Tty::
-C,--characters=list
Output these characters
Instance:
[Email protected] ~]# Cat/etc/gshadow |cut-c 1,3,5
Ro:
Bn
Deo
Ss:
Am:
Ty
-D,--delimiter=delim
Replace TAB field separator with DELIM
-F,--fields=list
Output these fields
Instance:
Separated by a colon, remove lines 6th through 10th of the/etc/passwd file
[[email protected] ~]# cat/etc/passwd |cut-d:-F 6-10
/root:/bin/bash
/bin:/sbin/nologin
/sbin:/sbin/nologin
/var/adm:/sbin/nologin
/var/spool/lpd:/sbin/nologin
/sbin:/bin/sync
/sbin:/sbin/shutdown
Linux--cut command