Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

For example, I have a text file, each line is a long string. I want to exclude 2 "segments" of this string, say columns 1-7 and 20-22. So the bottom 2 lines below would be a match:


I know WinMerge has a "IgnoreColumns" plugin but I have never go this working. In this example I would rename it IgnoreColumns_1-7, 20-22.dll, select it in the plugins menu, and choose "Pre-Differ." but it has never worked.

I am going to be comparing huge files that I don't want to modify. I'm not opposed to stream editing them in the comparison with sed or something like that, but I would prefer not to modify the actual files. I have not chose to feed sed to diff yet just because I was hoping for for a more visual view of the data.

share|improve this question
Do you have the program open or closed when you're renaming the file? Maybe you need to restart WM or reload plugins. I just tried WinMerge (ver 2.13.20): put each line of your sample into a different file, and diffed them. WinMerge showed the difference at first, but once I loaded the plugin it said that they were identical. – afrazier Jul 29 '11 at 19:45

The following works on Linux and on Cygwin.

vimdiff <(cut -c8-19,23- file1) <(cut -c8-19,23- file2)

For some reason on Cygwin, Vim prompts that each file has changed since editing started and asks, "[O]K, (L)oad File:". Just type O each time.

Granted you don't get to see the omitted columns, but it is a visual, side-by-side comparison.

share|improve this answer

If you'd still like to get the WinMerge "IgnoreColumns" plugin working... it looks like you're close. Two notes:

  1. For your example, in WinMerge's MergePlugins subfolder, copy IgnoreColumns.dll to IgnoreColumns_1-7_20-22.dll (no spaces, and using underline instead of comma).

  2. Exit WinMerge entirely, and re-run it, after placing that DLL. ("Reload plugins" will update the Plug-ins / List pull-down menu, but will not update the functionality.)

Side note: I recommend a "supported but unofficial" version of WinMerge – – that includes 3-way comparisons. Go to Unofficial WinMerge builds, and at the bottom you'll see the "3-way diff supported version".

share|improve this answer

Just as Diogo_Rocha's answer, you could modify the file beforehand to remove the columns you do not want to test, then run diff. But with just commandline stuff.

So for your example, removing 'columns' 1-7 and 20-22 you could.

sed 's/.\{7\}\(.\{12\}\).\{3\}\(.*\)/\1\2/' test.txt > test2.txt
diff -u test2.txt whatnot.txt

Edit: Blatant thieverizing of garyjohn's better answer.

diff -u <(cut -c8-19,23- test1.txt) <(cut -c8-19,23- test2.txt) | less
share|improve this answer
question updated. i have a lot of files so copying would be a pain, but might be the best bet. but I guess my original question stands - is there a diff utility that does this out of the box? – user39160 Jul 29 '11 at 19:18
Essentially garyjohn's answer is what you need. No need to duplicate files, feed modified files on stdin to diff or his version with vimdiff. And easier with cut rather than sed. – Nicholi Jul 29 '11 at 20:01

If I could understand your doubt, you are trying to exclude or select specific colums from a text file. If it is true, you can do it with the textpad application. Install it and open your text file, then press your "Alt" key on the same time that you select specific colums from your text. With these colums selected you can copy, cut or delete each one you need.

share|improve this answer
question updated – user39160 Jul 29 '11 at 19:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .