Using diff to perform the mapping between line numbers of two almost similar files

I have a text file and its updated version.I need to use diff command to discover the difference in line numbers in between the two text files.Is there any way by which i could directly get the mapping betwen the line numbers. Currently i use this code diff -ab file1 file2 and this outputs me

< parameter [3:0] state12=4'b 1011;
> parameter [3:0] state12=4'b 1011;
> parameter [3:0] state13=4'b 1100;
> parameter [3:0] state14=4'b 1101;
<           next_state = state02;

however i would like something on these lines

where the 1st number is the line number in the file1 and the second number is the corresponding line number in file2.Else i would have to write a script in python to decode the use of a,c.d Thanking you in advance


To do this, you need a diff tool that can recognize when code has moved, not merely been inserted/deleted.

Our Smart Differencer family of tools can do this. SmartDifferencers parse the code text using a real parser, and then matches where phrases are moved/copied/modified. The output identifies for each original code block that change somehow, precise down to the line and column numbers, whether code has been deleted, moved, copied, etc. There are SmartDifferencers for many standard programming languages (you seem to working with Verilog, and yes there is one for that).

You'd still need a script to convert the SmartDifferencer output into the form you are looking for.

Need Your Help

Use a Scala collection method to help convert a list of [0,0,0,1,1,1,1,0,0,1,1] into [3,4,2,2]

scala scala-collections

So I have a list of 0's and 1's, I want to find the count of each element and output this to a list. I can think of a recursive way to do it with functions but is there any helper functions which can