Carbon Carbon - 3 months ago 7
Bash Question

How to delete end of String in CSV file shell script?

I have a csv file that has over 10,000 entries called csv1.csv that I need to manipulate. I want to change the 11th column all the values which contain the email addresses of different people.
What I have right now in column 11:

E-mail Address

Desired output:


I also want to keep all other 12 columns the same and use redirect > to put in another csv file. So essentially only taking out the, but keeping whatever is in front of the string. Any help would be appreciated! Thanks!


Using awk you can modify any particular column like this:

awk -F, '{sub(/@.+/, "", $11)} 1' file.csv > newfile.csv