Skip to main content
Topic: diff work comparing two text file by ignoring colum (Read 222 times) previous topic - next topic
0 Members and 2 Guests are viewing this topic.

diff work comparing two text file by ignoring colum

How do we compare two text file using diff or git diff by ignoring a column
that is e.g. the last column with "." delimiter such

Code: [Select]
FILE A            FILE B

Foo.bar           Foo.bar.baz
Moo.bar           Moo.bar.baz
Zoo.bar           Zoo.bar.baz
is supposed to be identical, and for

Code: [Select]
FILE A            FILE B

Foo.bar           Foo.bar.baz
Moo.bar           Moo.bar.baz
Joo.bar           Hoo.bar.baz
Hoo.bar           Zoo.bar.baz
Zoo.bar

is supposed to be that diff reports sort of; extra line Joo.bar on FILE A or deleted line Joo.bar on FILE B
Help out sincerely.

Re: diff work comparing two text file by ignoring colum

Reply #1
First thing that comes to mind is to process FILE B first using cut (see man page if unfamiliar).