I am trying to use the standard diff command in Linux inorder to find differences in 2 files.The contents of the file are as follows:
File1
Jim
Jack
Tracy*
Michelle
File2
Jim
Jack
Tracy
Michael
diff File1 File2 gives me the following :
< Tracy*
< Michelle
---
> Tracy
> Michael
However,I want diff to ignore the asterix(*) and give the following output :
< Michelle
---
> Michael
Is it possible to do that ?
diff is a command-line utility that allows you to compare two files line by line. It can also compare the contents of directories. The diff command is most commonly used to create a patch containing the differences between one or more files that can be applied using the patch command.
The Linux diff command is used to compare two files line by line and display the difference between them. This command-line utility lists changes you need to apply to make the files identical.
diff stands for difference. This command is used to display the differences in the files by comparing the files line by line. Unlike its fellow members, cmp and comm, it tells us which lines in one file have is to be changed to make the two files identical.
Try
diff -I '*$' FILE1 FILE2
-I RE --ignore-matching-lines=RE
Ignore changes whose lines all match RE
Note: this only works with line ending asterisks.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With