Extract columns from file

Ubuntu - Command Line Tools

# print column 2 of file 'table.csv'

cut  -f 2  table.csv

# save column 2 to new file

cut  -f 2  table.csv > column2.txt

# print column 3 and 4 of file 'table.csv'

cut  -f 3,4  table.csv

# switch columns 3 and 4  (merge extracted columns in any order)

paste <(cut -f4 table.csv) <(cut -f3 table.csv)

# get last column of a table (reverse text lines, cut first column; and reverse back)

cat mytable.csv | rev | cut -f 1 | rev


See also

→ awk

split large file into multiple smaller parts