Skip to main content
1 of 4
Kusalananda
  • 355.9k
  • 42
  • 735
  • 1.1k

Assuming that this is a simple CSV file, without any fancy embedding of commas in the actual data, you may use awk to do this:

awk -F ',' '$1 != $2' <input.csv

This is a shorthand way of writing

awk 'BEGIN { FS = "," } $1 != $2 { print }' <input.csv

and it sets the input field separator to a comma and prints each line if the first and second field ($1 and $2) are not identical.

Kusalananda
  • 355.9k
  • 42
  • 735
  • 1.1k