Options (5)
-c, --charactersbooleanPrint the fifth character on each line
Example:
{{command}} | cut {{[-c|--characters]}} 5-f, --fieldsbooleanSplit each line in a file by a delimiter into fields and print fields two and six (default delimiter is `TAB`)
Example:
cut {{[-f|--fields]}} 2,6 {{path/to/file}}-d, --delimiterbooleanSplit each line by the specified delimiter and print all from the second field onward
Example:
{{command}} | cut {{[-d|--delimiter]}} "{{delimiter}}" {{[-f|--fields]}} 2--s, --only-delimitedbooleanOnly print lines that contain the delimiter
Example:
{{command}} | cut {{[-d|--delimiter]}} "{{:}}" {{[-f|--fields]}} {{1}} {{[-s|--only-delimited]}}-z, --zero-terminatedbooleanPrint specific fields of lines that use `NUL` to terminate lines instead of newlines
Example:
{{find . -print0}} | cut {{[-z|--zero-terminated]}} {{[-d|--delimiter]}} "{{/}}" {{[-f|--fields]}} {{2}}Examples (7)
Print the fifth to tenth character of each line of the specified file
cut [-c|--characters] 5-10 path/to/fileSplit each line in a file by a delimiter into fields and print fields two and six (default delimiter is `TAB`)
cut [-f|--fields] 2,6 path/to/fileSplit each line by the specified delimiter and print all from the second field onward
Use space as a delimiter and print only the first 3 fields
Only print lines that contain the delimiter
made by @shridhargupta | data from tldr-pages