Discussion:
I would like to make a suggestion for the diff command.
(too old to reply)
Jeff Silverman
2014-08-04 21:37:28 UTC
Permalink
People,

I am using diff 2.8.1

I have a command which comes in two variants. The command outputs a single
line that is a couple of thousand characters long. The diff command
correctly outputs that the two lines are different, but I would like to
know which characters within the line are different.

I would like you to add a --color switch to make diff output the characters
that are different in different colors, say red for deletions and green for
additions. The diff command would have to sense the terminal type to see
if it is color capable.


Thank you


Jeff
***@sweetlabs.com
--
*Jeff Silverman*
Systems Engineer
(253) 459-2318 (c)
Bob Proulx
2014-08-05 17:58:27 UTC
Permalink
Post by Jeff Silverman
I have a command which comes in two variants. The command outputs a single
line that is a couple of thousand characters long. The diff command
correctly outputs that the two lines are different, but I would like to
know which characters within the line are different.
Check out the wdiff program. It will do what you want.

https://www.gnu.org/software/wdiff/

bash$ wdiff <(echo one two three) <(echo one too three)
one [-two-] {+too+} three

Also see the -t option for terminal highlighting.

Also note that the diffutils have a dedicated mailing list. You can
reach the diffutils developers directly at the bug-***@gnu.org
address. Here is the web page with more information.

https://www.gnu.org/software/diffutils/
Post by Jeff Silverman
I would like you to add a --color switch to make diff output the characters
that are different in different colors, say red for deletions and green for
additions. The diff command would have to sense the terminal type to see
if it is color capable.
Also check out the "colordiff" program.

http://www.colordiff.org/

Bob

Loading...