cut you can select any column and define a custom delimiter to support multiple input formats you can select a column (or more) with barely minimum code.
cut -d',' -f2 myFile.csv
The above command will read the file
myFile.csv (which is a
CSV file) break it down to columns using the ‘
,‘ character and then get the second column.
-f specifies which field (column) you want to extract, and the option
-d specifies what is the field delimiter (column) that is used in the input file.
-f parameter allows you to select multiple columns at the same time. You can achieve that by defining multiple columns separated using the ‘
,‘ and by defining ranges using the
-f1selects the first column
-f1,3,4selects columns 1, 3 and 4
-f1-4selects all columns in the range 1-4
-f1,3,5-7,9selects columns 1,3,8 and all the columns in the range 5-7
This post is also available in: Greek