[Gllug] diff of two functions
Tethys
sta296 at astradyne.co.uk
Tue Sep 13 23:21:30 UTC 2005
Martin N Stevens writes:
>I've got two functions in a file and I want to compare them, is diff
>the best way to do this and how, or is there some funky function in
>vim ?
>
> [...]
>
>What are the differences ? can diff do diff on the same file but
>between two groups of line numbers ?
A combination of vi, bash process substitution and diff can get you
what you want:
:!diff <(tail +6 % | head -4) <(tail +15 % | head -5)
This assumes that func1 starts on line 6 and is 4 lines long, and that
func2 starts on line 15 and is 5 lines long.
But in reality, it's probably quicker to set a couple of marks, write
out each function to separate temp files, and diff them there. Counting
lines is just tedious.
Tet
--
Gllug mailing list - Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug
More information about the GLLUG
mailing list