bash method to remove last 4 columns from csv file
Cut can do this if all lines have the same number of fields or awk if you don't.
cut -d, -f1-6 # assuming 10 fields
Will print out the first 6 fields if you want to control the output seperater use --output-delimiter=string
awk -F , -v OFS=, '{ for (i=1;i<=NF-4;i++){ printf $i, }; printf "\n"}'
Loops over fields up to th number of fields -4 and prints them out.
You can use cut
for this if you know the number of columns. For example, if your file has 9 columns, and comma is your delimiter:
cut -d',' -f -5
However, this assumes the data in your csv file does not contain any commas. cut
will interpret commas inside of quotes as delimiters also.