-f, --fields
Select only these fields; also print any line that contains no delimiter character, unless the -s option is specified.
An option of cutx.
Usage
cutx -f string OPTION... [FILE]...
cutx --fields=string OPTION... [FILE]...Details
| Short | Long | Value | Default | Meaning |
|---|---|---|---|---|
-f | --fields | string | select only these fields; also print any line that contains no delimiter character, unless the -s option is specified |
Examples
Print the first field of each line of a TAB-separated file
cutx -f 1 data.tsvPrint the user names and shells from a colon-separated file
cutx -d : -f 1,7 /etc/passwdPrint the second and third columns of a CSV file
cutx -d , -f 2-3 people.csvPrint every column from the third on
cutx -d , -f 3- people.csvDrop the second column, keeping the rest
cutx -d , -f 2 --complement people.csvConvert a CSV file to TAB-separated output
cutx -d , -f 1- --output-delimiter=$'\t' people.csvJoin the selected columns with a custom separator
cutx -d : -f 1,3 --output-delimiter=' -> ' passwd.txtSkip lines that contain no delimiter, such as comments
cutx -s -d = -f 2 settings.iniPull one field out of a command's output
echox 'key=value' | cutx -d = -f 2Process NUL-separated records
cutx -z -d / -f 1 paths.lstHelp in the terminal
gnux help cutx --fields