I have a CSV file (CSV UTF-8 (Comma delimited) (.csv)) with 5 columns: customer data, customer first name, customer email, cancel reason, cancel reason comments
How would I filter the rows that have "Wanted item later, choose not to get it later" in the cancel reason column and then read it into a new file called input1.csv?
Below is what I tried, but input1.csv came out blank:
awk -F , '$4 == "Wanted item later, choose not to get it later" { print }' input.csv > input1.csv
Here is a sample input from input.csv file:
cancellation date,customer first name,customer email,cancel reason,cancel reason comments
1/22/17,aaaa,xxxxx@xxxxx.com,"Wanted item later, choose not to get it later", test
awk
knows nothing about quoted fields - once you set its field separator to,
it will treat every comma as a separator, and hence consider your string to be two fields. You will need to use one of the more CSV-aware solutions proposed in the answers to your earlier question