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
Hi@yahoo.com
What@yahoo.com
Up@yahoo.com
lol@yahoo.com
Desired output:
Hi
What
Up
lol
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 @yahoo.com, but keeping whatever is in front of the string. Any help would be appreciated! Thanks!
答案 0 :(得分:3)
Using awk you can modify any particular column like this:
awk 'BEGIN{FS=OFS=","} {sub(/@.+/, "", $11)} 1' file.csv > newfile.csv
答案 1 :(得分:0)
希望这会有所帮助。
cat csv1.csv | awk '{print $11}' | awk -F '@' '{print $1}'