A four-line CSV file with one city written as “New York, NY” was enough to break cut. Asked for the second column, it returned "New York for that row, and the score column came back as NY" instead of 88. The command did exactly what its manual says it does. The file just wasn’t the simple, comma-only text that cut assumes. These three small tools, cut for columns, tr for characters and paste for joining, are fast and everywhere on Linux and macOS, and every example below was run with GNU coreutils to show both what they do well and where they quietly give wrong answers.
cut: pulling out columns
Fields with a delimiter
The cut manual page describes -d as “use DELIM instead of TAB for field delimiter” and -f as “select only these fields.” With a clean CSV file:
$ cat clean.csv
name,city,score
Ana,Boston,91
Li,Denver,88
Sam,Austin,79
$ cut -d, -f1,3 clean.csv
name,score
Ana,91
Li,88
Sam,79
Tab is the default delimiter, so tab-separated files need no -d at all. A blank field between two tabs comes back as an empty line, which keeps the rows aligned with the original file.
Characters and bytes
-c selects character positions and -b selects byte positions. cut -c1-3 on the same file returned nam, Ana, Li, and Sam, three positions from each line whether or not that crosses a comma.
Order can’t be changed
Asking for -f3,1 doesn’t swap the columns. The man page states that “selected input is written in the same order that it is read, and is written exactly once.” cut -d, -f3,1 printed name,score, exactly what -f1,3 prints. Reordering needs a different tool:
$ awk -F, -v OFS=, '{print $3,$1}' clean.csv
score,name
91,Ana
Everything except one column
GNU cut adds --complement, which the manual describes as “complement the set of selected bytes, characters or fields.” cut -f2 --complement users.tsv dropped the middle column of a three-column file and kept the rest.

Where cut gets it wrong
Quoted CSV fields
The quoted city in the first example breaks the assumption that every comma separates fields:
$ cat people.csv
name,city,score
Ana,Boston,91
Li,"New York, NY",88
Sam,Austin,79
$ cut -d, -f2 people.csv
city
Boston
"New York
Austin
The damage spreads. Summing the score column with cut -d, -f3 people.csv | tail -n +2 | paste -sd+ | bc failed with illegal character: ", because the third field of the Li row was NY". On the clean file, the same pipeline built 91+88+79 and printed 258. Real CSV files with quoted fields need a CSV-aware tool, such as Python’s csv module or a dedicated utility.
Columns separated by several spaces
Output from commands like ps is aligned with runs of spaces. cut -d' ' -f2 on such text returned three empty lines, because two spaces in a row create an empty field between them. Squeezing the spaces first fixes it:
$ tr -s ' ' < ps.txt | cut -d' ' -f2
pid
1
812
Lines with no delimiter
The man page’s description of -f includes a surprise: it will “also print any line that contains no delimiter character, unless the -s option is specified.” A line reading just x came back as x from cut -d, -f2, a whole line where a second field was expected. With -s, it was dropped.
UTF-8 text
On this GNU build, cut -c1-4 on the word café returned the bytes c a f 303, the first half of the two-byte é, leaving a broken character. GNU cut treats -c like -b for multibyte text, so character positions in UTF-8 aren’t reliable with it.
tr: translating and deleting characters
What it does
The tr manual page sums it up in one line: “Translate, squeeze, and/or delete characters from standard input, writing to standard output.” It reads only from standard input, so files are fed with < or a pipe, never given as an argument.
Case conversion
$ echo 'Hello, World' | tr 'a-z' 'A-Z'
HELLO, WORLD
$ echo 'Hello' | tr '[:lower:]' '[:upper:]'
HELLO
The character classes [:lower:] and [:upper:] should be quoted so the shell doesn’t treat them as filename patterns.
Delete, squeeze, complement
$ echo 'Order #4521 shipped 2025-12-01' | tr -d '0-9'
Order # shipped --
$ echo 'too many spaces' | tr -s ' '
too many spaces
$ echo 'a:b:c' | tr ':' '\n'
a
b
c
-d deletes listed characters, -s squeezes runs of a repeated character into one, and -c (complement) applies the operation to every character not listed. Combined, tr -dc 'a-z\n' keeps only lowercase letters and newlines.

Two common tr jobs and one limit
Windows line endings
Files saved on Windows end each line with a carriage return and a newline. cat -A shows the carriage return as ^M:
$ cat -A win.txt
line1^M$
line2^M$
$ tr -d '\r' < win.txt | cat -A
line1$
line2$
Stray carriage returns break string comparisons in scripts and add invisible characters to the last field of every line, so stripping them is often the first step when processing a file from another system.
Splitting a list into lines
Translating a separator into \n turns a colon-separated value like a PATH into one entry per line, which other line-based tools can then sort, count or search.
Multibyte characters
tr 'a-z' 'A-Z' on café printed CAFé, leaving the accented letter alone. The man page says full support is only available in single-byte locales and that multibyte encodings are not fully supported. Case conversion of non-English text needs a Unicode-aware tool.
paste: joining files side by side
Line by line
The paste manual page describes it as writing “lines consisting of the sequentially corresponding lines from each FILE, separated by TABs.” With one file of letters and a shorter file of numbers:
$ paste -d, l.txt n.txt
a,1
b,2
c,
When one file runs out, paste keeps going with empty fields rather than stopping, so mismatched lengths show up as blanks instead of silently disappearing.
Serial mode
-s pastes one file at a time, putting all its lines on a single line. paste -s -d, l.txt produced a,b,c. That’s the trick behind the summing pipeline earlier: paste -sd+ joins a column of numbers with plus signs, and bc evaluates the result.
Reshaping with dashes
Each - reads another line from standard input, so paste - - < file joins every two lines into one. It turns a list of alternating labels and values into pairs, or a single column into two.

Putting them together
Counting values in a column
A sample file in the format of /etc/passwd, where fields are separated by colons and the seventh is the login shell, shows the classic pipeline:
$ cut -d: -f7 passwd.sample | sort | uniq -c | sort -rn
2 /usr/sbin/nologin
2 /bin/bash
1 /bin/zsh
cut isolates the column, sort groups identical values, uniq -c counts each group and the final sort -rn puts the biggest counts first. The same four steps answer “how many orders per status” or “which IP addresses appear most” in any delimited log.
Reordering columns without awk
cut can’t swap columns, but paste can put two separate cut results side by side in any order. In Bash, process substitution makes it one line:
$ paste -d, <(cut -d, -f3 clean.csv) <(cut -d, -f1 clean.csv)
score,name
91,Ana
88,Li
79,Sam
Changing the output separator
GNU cut also has --output-delimiter, which the man page describes as “use STRING as the output delimiter; the default is to use the input delimiter.” cut -d: -f1,7 --output-delimiter=' -> ' passwd.sample printed root -> /bin/bash and daemon -> /usr/sbin/nologin, a readable list without a second command.
A short reference
Choosing the tool
- One or more fixed columns from simple delimited text:
cut -d, -f1,3 - Columns separated by runs of spaces:
tr -s ' ' | cut -d' ' -fN, orawk '{print $N}' - Reorder columns:
awk - Change, delete or squeeze characters:
tr - Strip Windows line endings:
tr -d '\r' - Join files side by side:
paste - Join a column into one line:
paste -sd, - Real CSV with quoted fields: a CSV parser, not
cut
Checking the input first
Most surprises from these tools come from input that isn’t what it seems: hidden carriage returns, doubled spaces, quoted commas, multibyte letters. Running cat -A on a few lines before writing a pipeline shows tabs as ^I, carriage returns as ^M and line ends as $, which explains most of them in advance.
The file command gives a faster first answer for line endings. On the test files, it reported win.txt as ASCII text, with CRLF line terminators and clean.csv as plain CSV ASCII text, so a Windows-format file announces itself before any pipeline runs.
Sources
- cut(1), Linux manual page: https://man7.org/linux/man-pages/man1/cut.1.html
- tr(1), Linux manual page: https://man7.org/linux/man-pages/man1/tr.1.html
- paste(1), Linux manual page: https://man7.org/linux/man-pages/man1/paste.1.html
