cut
ShellFundamentals In simulator In real LinuxSelect fields or characters from each line
Name: cut
You can practise it right away in the simulator, and use it in real Linux mode too.
Description
cut extracts parts of each line: fields with -f (separator set by -d, tab by default), character positions with -c or bytes with -b. It suits data with a fixed delimiter, such as CSV or /etc/passwd; for irregular whitespace awk is a better fit.
Syntax
cut OPTION... [FILE]...Common options
| -d / --delimiter DELIM | Field delimiter (default: tab) |
| -f / --fields LIST | Fields to select, e.g. 1,3 or 2-4 |
| -c / --characters LIST | Character positions, e.g. 1-5 |
| -b / --bytes LIST | Select bytes, e.g. -b 1-4 |
| -s / --only-delimited | Skip lines without the delimiter |
| --complement | Print everything except the selection |
| --output-delimiter STRING | Join the output fields with STRING |