I have a CSV file with three columns:
id,text,date
123,hi 你好吗?,2016-01-01
246,this is stackoverflow 我需要帮忙,2016-02-01
I only want to edit column 2, where I delete only English characters and keep Chinese ones. The remaining columns remain intact.
The output I want:
id,text,date
123,你好吗?,2016-01-01
246,我需要帮忙,2016-02-01
Is there a better way to do this than this:
cat myfile.csv|cut -d, -f2|sed 's/[a-zA-Z]*//g' > tmp.csv
paste -d, myfile.csv tmp.csv|awk -F, '{OFS=",";print $1,$7,$3}' >tmp2.csv
source
share