utility

cut

Select delimiter-separated fields; not a CSV parser. Lines without the delimiter pass through unless -s is used.

Formal Syntax & Structure

bash syntaxbash
cut -d DELIMITER -f LIST [FILE ...]

Parameters & Attributes

NameTypeDescription
DELIMITERcharacterSingle field separator.
LISTstringField numbers or ranges.

Return Value

exit status

Exit status 0 on success; nonzero indicates failure or a command-specific condition. See description and example.

Working Example

Example Snippetbash
printf '%s\n' 'INFO:ready' 'WARN:retry' 'ERROR:failed' | grep -E '^(WARN|ERROR):' | cut -d ':' -f 2
Bash Reference