cut command
The cut command, which extracts columns from each line, either by character position or by fields split on a delimiter.
In more detail
cut -d, -f2 takes the second comma-separated field; the default delimiter is a tab. It cannot treat several spaces as one separator, so use awk for columns aligned with runs of spaces.
Examples
cut -d' ' -f4 access.logcut -c1-4cut -d= -f2 release.txtRelated terms
- awk — A small programming language for text that splits each line into fields and runs actions on the lines that match a condition.
- sort command — The sort command, which puts lines in order, alphabetically by default.
- pipe — The | operator, which connects one command's standard output to the next command's standard input so they run together.
- grep — The command that prints the lines of its input that match a pattern.
Taught in
- Pipelines, tee And Process Substitution — Bash Scripting & Command Line Automation
- Reshaping Text: cut, sort, uniq, tr, sed, awk — Bash Scripting & Command Line Automation
- Workflows, Jobs, Steps, and Actions — Continuous Integration & Continuous Delivery Pipelines
- Securing Pipelines: Secrets Management — Continuous Integration & Continuous Delivery Pipelines
- Artifact Promotion: Staging to Production — Continuous Integration & Continuous Delivery Pipelines
- SSH Keys And An Account For Ansible — RHCE in Ansible (EX294): Automate Red Hat Systems