Highlight differences between lines The Next CEO of Stack OverflowHow can I get the most bang for my buck with the “diff” command?Compare two similar directories and list differences between filesHighlight differences between two files, similar to what watch -d producesColor output of linux command similar to 'watch -d' to highlight differences?Evaluate differences between two filesGetting differences of file between specific revisions/branchesDiffing for metadata differencesCompare two zip files for differencesHow to produce a diff without lone identical linesuse 'diff-highlight' for diff

In the "Harry Potter and the Order of the Phoenix" video game, what potion is used to sabotage Umbridge's speakers?

Is there a way to save my career from absolute disaster?

Reshaping json / reparing json inside shell script (remove trailing comma)

How do I fit a non linear curve?

Players Circumventing the limitations of Wish

Why is information "lost" when it got into a black hole?

Touchpad not working on Debian 9

Can I board the first leg of the flight without having final country's visa?

Film where the government was corrupt with aliens, people sent to kill aliens are given rigged visors not showing the right aliens

How to avoid supervisors with prejudiced views?

Is there a reasonable and studied concept of reduction between regular languages?

My ex-girlfriend uses my Apple ID to login to her iPad, do I have to give her my Apple ID password to reset it?

"Eavesdropping" vs "Listen in on"

What steps are necessary to read a Modern SSD in Medieval Europe?

Computationally populating tables with probability data

TikZ: How to fill area with a special pattern?

Help! I cannot understand this game’s notations!

Man transported from Alternate World into ours by a Neutrino Detector

Why is the US ranked as #45 in Press Freedom ratings, despite its extremely permissive free speech laws?

What is the difference between "hamstring tendon" and "common hamstring tendon"?

Why doesn't UK go for the same deal Japan has with EU to resolve Brexit?

Is it professional to write unrelated content in an almost-empty email?

Is it correct to say moon starry nights?

Expectation in a stochastic differential equation



Highlight differences between lines



The Next CEO of Stack OverflowHow can I get the most bang for my buck with the “diff” command?Compare two similar directories and list differences between filesHighlight differences between two files, similar to what watch -d producesColor output of linux command similar to 'watch -d' to highlight differences?Evaluate differences between two filesGetting differences of file between specific revisions/branchesDiffing for metadata differencesCompare two zip files for differencesHow to produce a diff without lone identical linesuse 'diff-highlight' for diff










0















I have a file with near-identical lines which have some slight differences, and I want to have a highlight of the differences between each line.



Example:



  • The quick brown fox jumps over the lazy dog.

  • The quack brown fox leaps over the lazy dog.

  • The quack fox leaps over the very lazy dog.

  • The quack fox leaps oer the really very lazy dog.

(here bold text marks characters that have been inserted and changed compared to the previous line, and italics marks characters that are removed in the next line).



The highlighting doesn't need to look exactly like in the example, but it should indicate which characters have been added, changed or removed. And it should indicate this solely with highlighting (ie. no printing of old and new characters in one line), so that the actual text on each line is still identical to the original text.



I have tried to build something with dwdiff (iterating over the lines and then comparing consecutive lines), but haven't found a way to highlight deleted characters:



infile=$1
line1=
line2=
lineNo=0
while IFS="" read -r nextLine || [ -n "$nextLine" ]; do
line1=$line2
line2=$nextLine

if [[ "$lineNo" -gt 0 ]]; then
dwdiff -1 -c <(printf '%sn' "$line1") <(printf '%sn' "$line2")
else
printf '%sn' "$line2"
fi

lineNo=$((lineNo+1))
done


Ideally the diff would actually work on characters, but word-level differences would be OK as well.



Is there a way to get this result with dwdiff? Or is there an existing tool which does this?










share|improve this question






















  • Did you miss highlighting oer in the last line?

    – Inian
    2 days ago











  • @Inian: I have only highlighted the deleted "v" character in the line above. Not really easy to see; with colored highlighting this might be more usable. And yes, with word-level differences the entire "oer" would have to be highlighted.

    – oliver
    2 days ago















0















I have a file with near-identical lines which have some slight differences, and I want to have a highlight of the differences between each line.



Example:



  • The quick brown fox jumps over the lazy dog.

  • The quack brown fox leaps over the lazy dog.

  • The quack fox leaps over the very lazy dog.

  • The quack fox leaps oer the really very lazy dog.

(here bold text marks characters that have been inserted and changed compared to the previous line, and italics marks characters that are removed in the next line).



The highlighting doesn't need to look exactly like in the example, but it should indicate which characters have been added, changed or removed. And it should indicate this solely with highlighting (ie. no printing of old and new characters in one line), so that the actual text on each line is still identical to the original text.



I have tried to build something with dwdiff (iterating over the lines and then comparing consecutive lines), but haven't found a way to highlight deleted characters:



infile=$1
line1=
line2=
lineNo=0
while IFS="" read -r nextLine || [ -n "$nextLine" ]; do
line1=$line2
line2=$nextLine

if [[ "$lineNo" -gt 0 ]]; then
dwdiff -1 -c <(printf '%sn' "$line1") <(printf '%sn' "$line2")
else
printf '%sn' "$line2"
fi

lineNo=$((lineNo+1))
done


Ideally the diff would actually work on characters, but word-level differences would be OK as well.



Is there a way to get this result with dwdiff? Or is there an existing tool which does this?










share|improve this question






















  • Did you miss highlighting oer in the last line?

    – Inian
    2 days ago











  • @Inian: I have only highlighted the deleted "v" character in the line above. Not really easy to see; with colored highlighting this might be more usable. And yes, with word-level differences the entire "oer" would have to be highlighted.

    – oliver
    2 days ago













0












0








0








I have a file with near-identical lines which have some slight differences, and I want to have a highlight of the differences between each line.



Example:



  • The quick brown fox jumps over the lazy dog.

  • The quack brown fox leaps over the lazy dog.

  • The quack fox leaps over the very lazy dog.

  • The quack fox leaps oer the really very lazy dog.

(here bold text marks characters that have been inserted and changed compared to the previous line, and italics marks characters that are removed in the next line).



The highlighting doesn't need to look exactly like in the example, but it should indicate which characters have been added, changed or removed. And it should indicate this solely with highlighting (ie. no printing of old and new characters in one line), so that the actual text on each line is still identical to the original text.



I have tried to build something with dwdiff (iterating over the lines and then comparing consecutive lines), but haven't found a way to highlight deleted characters:



infile=$1
line1=
line2=
lineNo=0
while IFS="" read -r nextLine || [ -n "$nextLine" ]; do
line1=$line2
line2=$nextLine

if [[ "$lineNo" -gt 0 ]]; then
dwdiff -1 -c <(printf '%sn' "$line1") <(printf '%sn' "$line2")
else
printf '%sn' "$line2"
fi

lineNo=$((lineNo+1))
done


Ideally the diff would actually work on characters, but word-level differences would be OK as well.



Is there a way to get this result with dwdiff? Or is there an existing tool which does this?










share|improve this question














I have a file with near-identical lines which have some slight differences, and I want to have a highlight of the differences between each line.



Example:



  • The quick brown fox jumps over the lazy dog.

  • The quack brown fox leaps over the lazy dog.

  • The quack fox leaps over the very lazy dog.

  • The quack fox leaps oer the really very lazy dog.

(here bold text marks characters that have been inserted and changed compared to the previous line, and italics marks characters that are removed in the next line).



The highlighting doesn't need to look exactly like in the example, but it should indicate which characters have been added, changed or removed. And it should indicate this solely with highlighting (ie. no printing of old and new characters in one line), so that the actual text on each line is still identical to the original text.



I have tried to build something with dwdiff (iterating over the lines and then comparing consecutive lines), but haven't found a way to highlight deleted characters:



infile=$1
line1=
line2=
lineNo=0
while IFS="" read -r nextLine || [ -n "$nextLine" ]; do
line1=$line2
line2=$nextLine

if [[ "$lineNo" -gt 0 ]]; then
dwdiff -1 -c <(printf '%sn' "$line1") <(printf '%sn' "$line2")
else
printf '%sn' "$line2"
fi

lineNo=$((lineNo+1))
done


Ideally the diff would actually work on characters, but word-level differences would be OK as well.



Is there a way to get this result with dwdiff? Or is there an existing tool which does this?







diff






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 2 days ago









oliveroliver

28614




28614












  • Did you miss highlighting oer in the last line?

    – Inian
    2 days ago











  • @Inian: I have only highlighted the deleted "v" character in the line above. Not really easy to see; with colored highlighting this might be more usable. And yes, with word-level differences the entire "oer" would have to be highlighted.

    – oliver
    2 days ago

















  • Did you miss highlighting oer in the last line?

    – Inian
    2 days ago











  • @Inian: I have only highlighted the deleted "v" character in the line above. Not really easy to see; with colored highlighting this might be more usable. And yes, with word-level differences the entire "oer" would have to be highlighted.

    – oliver
    2 days ago
















Did you miss highlighting oer in the last line?

– Inian
2 days ago





Did you miss highlighting oer in the last line?

– Inian
2 days ago













@Inian: I have only highlighted the deleted "v" character in the line above. Not really easy to see; with colored highlighting this might be more usable. And yes, with word-level differences the entire "oer" would have to be highlighted.

– oliver
2 days ago





@Inian: I have only highlighted the deleted "v" character in the line above. Not really easy to see; with colored highlighting this might be more usable. And yes, with word-level differences the entire "oer" would have to be highlighted.

– oliver
2 days ago










0






active

oldest

votes












Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f509461%2fhighlight-differences-between-lines%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Unix & Linux Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f509461%2fhighlight-differences-between-lines%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

getting Checkpoint VPN SSL Network Extender working in the command lineHow to connect to CheckPoint VPN on Ubuntu 18.04LTS?Will the Linux ( red-hat ) Open VPNC Client connect to checkpoint or nortel VPN gateways?VPN client for linux machine + support checkpoint gatewayVPN SSL Network Extender in FirefoxLinux Checkpoint SNX tool configuration issuesCheck Point - Connect under Linux - snx + OTPSNX VPN Ububuntu 18.XXUsing Checkpoint VPN SSL Network Extender CLI with certificateVPN with network manager (nm-applet) is not workingWill the Linux ( red-hat ) Open VPNC Client connect to checkpoint or nortel VPN gateways?VPN client for linux machine + support checkpoint gatewayImport VPN config files to NetworkManager from command lineTrouble connecting to VPN using network-manager, while command line worksStart a VPN connection with PPTP protocol on command linestarting a docker service daemon breaks the vpn networkCan't connect to vpn with Network-managerVPN SSL Network Extender in FirefoxUsing Checkpoint VPN SSL Network Extender CLI with certificate

Cannot Extend partition with GParted The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) 2019 Community Moderator Election ResultsCan't increase partition size with GParted?GParted doesn't recognize the unallocated space after my current partitionWhat is the best way to add unallocated space located before to Ubuntu 12.04 partition with GParted live?I can't figure out how to extend my Arch home partition into free spaceGparted Linux Mint 18.1 issueTrying to extend but swap partition is showing as Unknown in Gparted, shows proper from fdiskRearrange partitions in gparted to extend a partitionUnable to extend partition even though unallocated space is next to it using GPartedAllocate free space to root partitiongparted: how to merge unallocated space with a partition

Marilyn Monroe Ny fiainany manokana | Jereo koa | Meny fitetezanafanitarana azy.