CUT(1)

✨ CUT(1) β€” the girlies' guide to slicing up lines ✨

okay so bestie, cut lives in the General Commands Manual and it's literally the moment you've been waiting for: it pulls little sections out of every single line of your files πŸ’–


πŸŽ€ NAME πŸŽ€

cut β€” extract sections from each line of files. periodt.


🌸 SYNOPSIS 🌸

cut OPTION... [FILE]...

πŸ¦‹ DESCRIPTION πŸ¦‹

Extract sections from each line of files. that's it, that's the whole vibe. you feed it lines, you tell it which bits you want, it gives you the bits. iconic behavior fr fr πŸ’…


πŸ‘‘ OPTIONS πŸ‘‘

  • -b, --bytes <LIST> β€” extract the bytes listed in LIST πŸ’œ
  • -c, --characters <LIST> β€” extract the characters listed in LIST πŸŽ€
  • -d, --delimiter <DELIM> β€” use DELIM as the field separator (default: Tab) ✨
  • -w, --whitespace-delimited[=<trimmed>] β€” use any whitespace (Space/Tab) as the delimiter; ignore leading and trailing blanks with 'trimmed' 🧚
    • Possible values:
      • trimmed
  • -f, --fields <LIST> β€” extract the fields listed in LIST 🌸
  • -F <LIST> β€” like -f, but merge adjacent delimiters; the delimiter defaults to whitespace and the output delimiter to a space 🫢
  • --complement β€” invert the selection: print all columns except the specified ones πŸ™ˆ
  • -s, --only-delimited β€” suppress lines that do not contain the delimiter πŸ’€
  • -z, --zero-terminated β€” use NULL (\0) instead of newline as the line terminator ⭐
  • -O, --output-delimiter <NEW_DELIM> β€” replace the input delimiter with NEW_DELIM in the output 🌈
  • -n, --no-partial β€” with -b, do not output partial multi-byte characters πŸ”₯
  • -h, --help β€” Print help 😌
  • -V, --version β€” Print version πŸ’…

πŸ’– EXTRA πŸ’–

If no FILE is specified, it reads from stdin. Use '-' as a FILE argument to include stdin. so cozy, so flexible, main character energy honestly πŸ¦‹

LIST is a comma-separated list of numbers or ranges:

N           only column N
N-          columns N through the end of the line
N-M         columns N through M
-M          columns 1 through M

Examples:

cut -f 2,5-7 file.txt             extract fields 2, 5, 6, and 7
cut -f 3- file.txt                extract field 3 to the end of the line
cut --complement -f 4-6 file.txt  extract all fields except 4, 5, and 6
cut -d',' -f1 file.csv            extract first field from a CSV

🌟 VERSION 🌟

v(uutils coreutils) 0.12.0


πŸ“ EXAMPLES πŸ“

Print the fifth character on each line:

command | cut [-c|--characters] 5

Print the fifth to tenth character of each line of the specified file:

cut [-c|--characters] 5-10 path/to/file

Split 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/file

Split each line by the specified delimiter and print all from the second field onward:

command | cut [-d|--delimiter] "delimiter" [-f|--fields] 2-

Use space as a delimiter and print only the first 3 fields:

command | cut [-d|--delimiter] " " [-f|--fields] -3

Only print lines that contain the delimiter:

command | cut [-d|--delimiter] ":" [-f|--fields] 1 [-s|--only-delimited]

Print specific fields of lines that use NUL to terminate lines instead of newlines:

find . -print0 | cut [-z|--zero-terminated] [-d|--delimiter] "/" [-f|--fields] 2
The examples are provided by the tldr-pages project <https://tldr.sh> under the CC BY 4.0 License. Please note that, as uutils is a work in progress, some examples might fail. 😭

okay that's the whole page bestie, you're officially a cut girlie now πŸŽ€βœ¨ this version is from v(uutils coreutils) 0.12.0, dated 2026-09-25 β€” go slice some lines, you ate πŸ’…πŸ‘‘

πŸ“¦ where this page comes from