![]() |
|
|
#1 |
|
Guest
Posts: n/a
|
Simple diff question
Very simple question, I hope. If I have two files or source trees, and I
want to have a count of the number of lines of code that have changed from one to the next version, what is the command string to obtain this info using diff? Or should I be using another utility instead? Thanks Lawson English |
|
|
|
#2 |
|
Guest
Posts: n/a
|
Re: Simple diff question
On Nov 2, 10:01 pm, Lawson English <> wrote:
> Very simple question, I hope. If I have two files or source trees, and I > want to have a count of the number of lines of code that have changed > from one to the next version, what is the command string to obtain this > info using diff? Or should I be using another utility instead? > > Thanks > > Lawson English I dont think you can do that . you can only use diff as a a tool to compare files that are different. you can always use nl command to count lines, both command on the same line <could> give you the result that your looking for but im afriad it would be very annoying outprint if you have a big file. i would suggest you write a perl script to do so. cheers, zaher el siddik |
|
|
|
#3 |
|
Guest
Posts: n/a
|
Re: Simple diff question
I think command wc is better:
wc -l filename but I don't know how to recursively deal with a directory "elsiddik" <> ??????:1194192898.749934.212540@o38g2000hse.google groups.com... > On Nov 2, 10:01 pm, Lawson English <> wrote: >> Very simple question, I hope. If I have two files or source trees, and I >> want to have a count of the number of lines of code that have changed >> from one to the next version, what is the command string to obtain this >> info using diff? Or should I be using another utility instead? >> >> Thanks >> >> Lawson English > > I dont think you can do that . > you can only use diff as a a tool to compare files that are different. > you can always use nl command to count lines, both command on the same > line <could> give you the result that your looking for but im afriad > it would be very annoying outprint if you have a big file. > i would suggest you write a perl script to do so. > > > cheers, > > zaher el siddik > > > > |
|
|
|
#4 |
|
Guest
Posts: n/a
|
Re: Simple diff question
On 11/2/2007 4:01 PM, Lawson English wrote: > Very simple question, I hope. If I have two files or source trees, and I > want to have a count of the number of lines of code that have changed > from one to the next version, what is the command string to obtain this > info using diff? Or should I be using another utility instead? Are you looking for differences between the 2 files of source trees, or differences between the files listed in the 2 files of source trees? How do you define a "changed line"? Diff reports every "change" as "added" and/or "deleted" lines: $ cat file1 a b c d e f g h i $ cat file2 a b c d x f g h i $ diff file1 file2 2c2 < d e f --- > d x f I don't know of any utility that can distinguish those cases where you changed something within a line from those cases where you deleted a line and then later inserted a different but possibly similair line. Do you just want the count of added lines, or both added and deleted separately or something else? Regards, Ed. |
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
< Windows Help - MS Office Help - Hardware Support >
| New To Site? | Need Help? |