terminal.cab

All commands

cut

Topic: Text

Program: cut

Cuts columns out of lines.

Package: text-sort

Usage

cut OPTION... [FILE]...

Description

Keep only the chosen bytes or fields of every line. LIST is N, N-M, N- or -M, several joined with commas; counting starts at 1. A FILE named -, or no FILE, means the keyboard or pipe.

Options in the simulator

3 more options of the real program, not in the simulator yet
  • -n not in the simulator yet

    On a real system -n does nothing in cut; it only exists for old scripts.

  • -z, --zero-terminated not in the simulator yet

    On a real system a zero byte instead of a newline ends each line, for names from find -print0.

  • --version not in the simulator yet

    On a real system it prints the version of the program.

Examples

From the lesson Sort and count
cut -d, -f2 orders.csv
city
Berlin
Hamburg
Berlin
Munich
Berlin
Hamburg
Berlin
Cologne
cut -d, -f1,3 orders.csv
customer,amount
anna,120
ben,80
cem,45
dana,200
eva,60
finn,15
gina,300
hugo,95

Try it in the terminal

Where you learn it

Lessons

All commands