commands

cut — extract selected fields

-d chooses a single delimiter byte for GNU field mode, -f selects fields starting at 1, -s suppresses lines without delimiters. Not a general CSV parser. Example assumes a fresh text-streams lab fixture.

Formal Syntax & Structure

linux syntaxlinux
cut OPTION... [FILE]...

Parameters & Attributes

NameTypeDescription
-doptionDelimiter
-foptionField selection
-soptionSuppress undelimited lines
FILEoperandInput file

Return Value

exit status and output

GNU cut prints selected fields or character/byte positions and returns nonzero on read/write or option errors. Lines with no delimiter can pass through unless -s is used; empty selections need not be errors.

Working Example

Example Snippetlinux
cut -d ':' -f 2 records.txt
Linux Reference