Skip to main content
added 13 characters in body
Source Link
Kusalananda
  • 355.8k
  • 42
  • 735
  • 1.1k

Assuming that this is a simple CSV file, without any fancy embedding of commas or newlines within the fields of 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 fieldfields ($1 and $2) are not identical.

An equivalent Perl variant:

perl -F ',' -na -e 'print if $F[0] ne $F[1]' <input.csv

Assuming that this is a simple CSV file, without any fancy embedding of commas within the fields of 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.

An equivalent Perl variant:

perl -F ',' -na -e 'print if $F[0] ne $F[1]' <input.csv

Assuming that this is a simple CSV file, without any fancy embedding of commas or newlines within the fields of 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 fields ($1 and $2) are not identical.

An equivalent Perl variant:

perl -F ',' -na -e 'print if $F[0] ne $F[1]' <input.csv
added 20 characters in body
Source Link
Kusalananda
  • 355.8k
  • 42
  • 735
  • 1.1k

Assuming that this is a simple CSV file, without any fancy embedding of commas inwithin the fields of 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.

An equivalent Perl variant:

perl -F ',' -na -e 'print if $F[0] ne $F[1]' <input.csv

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.

An equivalent Perl variant:

perl -F ',' -na -e 'print if $F[0] ne $F[1]' <input.csv

Assuming that this is a simple CSV file, without any fancy embedding of commas within the fields of 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.

An equivalent Perl variant:

perl -F ',' -na -e 'print if $F[0] ne $F[1]' <input.csv
added 94 characters in body
Source Link
Kusalananda
  • 355.8k
  • 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.

An equivalent Perl variant:

perl -F ',' -na -e 'print if $F[0] ne $F[1]' <input.csv

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.

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.

An equivalent Perl variant:

perl -F ',' -na -e 'print if $F[0] ne $F[1]' <input.csv
Source Link
Kusalananda
  • 355.8k
  • 42
  • 735
  • 1.1k
Loading