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
| Name | Type | Description |
|---|---|---|
| -d | option | Delimiter |
| -f | option | Field selection |
| -s | option | Suppress undelimited lines |
| FILE | operand | Input 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