0

I have following data set in csv and would like to filter this on multiple columns using awk (My Version is GNU 3.1.7)

How can i use awk to filter on multiple columns

i used following command but didn't give required result.

awk -F, '{ if ($7="3YM62AE#UUS" && $5="01CS") print $1","$2","$3","$4","$5","$6","$7","$14}' file1.csv > file2.csv

Let me know if i am using correct awk command.

enter image description here

1 Answer 1

1

Could you please try following. Haven't tested it but you need to change from = to ==.

awk '
BEGIN{
  FS=OFS=","
}
{
  if($7=="\"3YM62AE#UUS\"" && $5=="\"01CS\""){
    print $1,$2,$3,$4,$5,$6,$7,$14
  }
}' file1.csv > file2.csv
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.