Gossamer Forum
Home : General : Perl Programming :

diff - formatting nicely

Quote Reply
diff - formatting nicely
Hi,

I'm trying to write some code, which will do a direct comparison of 2 files.

I'm using:

Code:
diff --line-format='%3dn %L' file1.html file2.html

..this prints out like:
Code:
1 #!/usr/local/bin/perl
2 # ==================================================================
3 # Bla Bla
3 # Bla Bla Changed This
4 ################################################
5 Something else

(i.e repeats lines that have changed)

...now, this is good - BUT, what I need to do, is try and color code the bits that were taken out (and the bits that were not). i.e make bits red that were taken out - and green for bits that were added. Is there any way to combine the code I have above, and the -u (so it shows + and - or > and < next to lines that were modified)

Anyone got any suggestions? :/

i.e I need the output something like:

Code:
1 #!/usr/local/bin/perl
2 # ==================================================================
3 # Bla Bla
3 # Bla Bla Changed This
4 ################################################
5 Something else


TIA for any suggestions. I've come to a bit of a roadblock with this :(

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates