cut
Created: July 02, 2019
cut OPTION FILE
- When FILE is not given or is
-, stdin is read.
- Tab is the default delimiter.
cut can take integer ranges and (comma-separated) lists of integers as arguments, in addition to single integers.
Delimited Data
| Description |
Command |
Cut column X from delimited data. |
-f X |
| Change the delimeter from tab. |
-d "DELIMETER" |
| Ignore input lines that don’t contain delimiters. |
-s |
| Adjust the delimeter in the output to STRING. |
--output-delimited="STRING" |
Non-Delimited Data
| Description |
Command |
Cut character X from a line. |
-c X |
Cut byte X from a line. |
-b X |
Generic Options
| Description |
Command |
| Invert the cut logic. |
--complement |
| The line delimeter is NULL, not newline. |
-z |
Using Integer Ranges
For the options -f, -c, and -b, integer ranges can be used, in addition to single integers.
| Description |
Command |
| Between START and STOP. |
START-STOP |
| From the start of the line to STOP. |
-STOP |
| From START to the end of the line. |
START- |
- All options are inclusive and use one-based indexing.