unix - How do I perform a portable, readable and pipeable character-by-character diff from the command line? -


the standard diff tool useful find lines in file differ, doesn't work character-by-character differences. need merge texts character-by-character (i.e. written text, not code) modified without synchronization on different computers (yes, know shouldn't, happens anyway). apart adding paragraph or two, might have altered comma, spelling mistake or other small change in text common both files.

diff tell me lines changed, since there might multiple diffs per line, must scan lines find each physically small important diff per line. after fixing, must repeat diff make sure didn't miss edits. gets worse when lines paragraph formatted (i.e. 1 line per paragraph), , when many consecutive lines have such small differences.

right must admit load both files microsoft word , use built-in diff function. of course inconvenient start huge package word find small differences, @ least compares files on character-by-character basis.

what want unix way of doing this. small , cute tool or script character-by-character comparisons on text, i.e. not line based, able ignore line-endings, reporting sensible ascii-art, , pipeable use in scripts command line?

there question this, using 'diff' (or else) character-level diff between text files, question satisfied lib exemplified web-based tool, prefer on command-line.

i'm not sure if meet "command-line" criteria, use gvim / vim daily purpose.

  1. open files want diff this:

    gvim -d file1 file2 
  2. make window full-screen it's easier see

  3. make split-windows inside gvim equal size command: c-w = (that's control+w , =)

  4. to see paragraph formatted lines better, enter :set wrap, switch other split-window c-w w (or mouse-click) , there enter :set wrap

  5. to move between changes, use [c , ]c. to merge changes, use dp ("diff put") , do ("diff obtain/get").

lines differences highlighted, , differences within line highlighted color. hope need. gvim can more you, such merging 1 file other. can find out more command :help diff (inside gvim).

you can try kdiff3, might easier learning vim.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -