Compare by content: Possible to ignore first n lines?
Moderators: Hacker, petermad, Stefan2, white
-
- Junior Member
- Posts: 22
- Joined: 2005-03-28, 12:50 UTC
Compare by content: Possible to ignore first n lines?
I have a case where I need to compare two deep folder trees. Problem is that all files include a header, where a date and version number of the files is updated via script. If I compare by content, all files are marked as different, because this date and version number has been changed.
However, I'd like to know which files actually have different content apart from that header.
Is there any way, e.g. telling the sync tool to ignore the first n lines in each file?
However, I'd like to know which files actually have different content apart from that header.
Is there any way, e.g. telling the sync tool to ignore the first n lines in each file?
- ghisler(Author)
- Site Admin
- Posts: 50550
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
You can use file "filesys" content plugin as a starting point, it has a text compare function "ContentCompareFiles". All you need to do is skip the first X lines per file.
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
result "less" and "greater"?
Is it possible, in content plugin from ContentCompareFiles, to return result "less" and "greater"?
- ghisler(Author)
- Site Admin
- Posts: 50550
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
No, because the sync tool does not distinguish between larger/smaller files when selecting them. It only sets options equal, not equal, equal if text, left newer, right newer.
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
Thank you, Christian.
OK, how can I return "left newer", "right newer"?
In contentpluginhelp2.10se.zip/contentplugin.HLP it lists:
OK, how can I return "left newer", "right newer"?
In contentpluginhelp2.10se.zip/contentplugin.HLP it lists:
No option for "left newer", "right newer" is mentioned...1 The two files are equal, show equal sign in list
2 The two files are equal, show equal sign with 'TXT' below it in lists:
0 The two files are different
-1 Could not open at least one of the files
-2 Compare aborted
-3 The file cannot be compared with this function, please continue with the next plugin...
100 or higher The two files are equal. The plugin file contains a 16x16 icon resource with this numeric ID...
2JacobK
What do you want to achieve? TC's sync tool already compares file dates without comparison by contents (let alone by contents via content plugins).
Regards
Dalai
What do you want to achieve? TC's sync tool already compares file dates without comparison by contents (let alone by contents via content plugins).
Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Re: Re:
Find a compare tool with this function and create a button in TC for it
using %c1 %c2 as parameter.
Windows 11 Home, Version 24H2 (OS Build 26100.4061)
TC 11.55 RC2 x64 / x86
Everything 1.5.0.1391a (x64), Everything Toolbar 1.5.2.0, Listary Pro 6.3.2.88
QAP 11.6.4.4 x64
TC 11.55 RC2 x64 / x86
Everything 1.5.0.1391a (x64), Everything Toolbar 1.5.2.0, Listary Pro 6.3.2.88
QAP 11.6.4.4 x64
Re: Re:
Google for it and you may found Beyond Compare for example.
Windows 11 Home, Version 24H2 (OS Build 26100.4061)
TC 11.55 RC2 x64 / x86
Everything 1.5.0.1391a (x64), Everything Toolbar 1.5.2.0, Listary Pro 6.3.2.88
QAP 11.6.4.4 x64
TC 11.55 RC2 x64 / x86
Everything 1.5.0.1391a (x64), Everything Toolbar 1.5.2.0, Listary Pro 6.3.2.88
QAP 11.6.4.4 x64
Re: Compare by content: Possible to ignore first n lines?
WinMerge
/l linenumber -> Specifies a line number to jump to after loading the files.
/c charpos -> Specifies a character position to jump to after loading the files.
Example:
Mark the files to be compared, then press the button -> see: Button (CODE).
Button with command: Path\to\WinMergeU.exe /l 5 ... opens WinMerge and positions the cursor in the 5th line ...
The following setting in WinMerge is overridden, i.e. this setting is no longer valid:
Menu "Edit" -> "Options" -> General: Automatically scroll to first difference.
In this case, the button "Next Difference (Alt+Down)" must be pressed.
Note:
wincmd.ini -> section [Configuration]
-AND-
Button with command: cm_CompareFilesByContent
causes that instead of the internal comparison tool of Total Commander (cm_IntCompareFilesByContent)
the comparison tool WinMerge (cm_CompareFilesByContent) can be used in Total Commander.
WinMerge Help -> Command lineWinMerge is an Open Source differencing and merging tool for Windows.
WinMerge can compare both folders and files, presenting differences in a visual text format that is easy to understand and handle.
/l linenumber -> Specifies a line number to jump to after loading the files.
/c charpos -> Specifies a character position to jump to after loading the files.
Example:
Mark the files to be compared, then press the button -> see: Button (CODE).
Button with command: Path\to\WinMergeU.exe /l 5 ... opens WinMerge and positions the cursor in the 5th line ...
The following setting in WinMerge is overridden, i.e. this setting is no longer valid:
Menu "Edit" -> "Options" -> General: Automatically scroll to first difference.
In this case, the button "Next Difference (Alt+Down)" must be pressed.
Button (CODE)
Path to WinMergeU.exe must be adjusted!
Code: Select all
TOTALCMD#BAR#DATA
%COMMANDER_PATH%\Tools\WinMergePortableZip\WinMergeU.exe /l 5
%c1 %c2
%COMMANDER_PATH%\Tools\WinMergePortableZip\WinMergeU.exe
%COMMANDER_PATH%\Tools\WinMergePortableZip\WinMergeU.exe /l 5|WinMergePortable 2.16.20 x64 (Compare files/folders)|https://ghisler.ch/board/viewtopic.php?t=48634|Compare by content: Possible to ignore first n lines?|WinMerge https://winmerge.org/?lang=en
-1
Create a Button in the Buttonbar (copy/paste CODE)
- Click on "SELECT ALL" (to the right of CODE:), then press CTRL+C (copy to clipboard).
- Right-click on any place in the button bar, then click on "Paste".
⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺ - Option1: Point to the new button (slightly longer): 'Tooltip' is shown (-> description to the button).
A maximum of 259 characters is allowed for the tooltip. | = create line break, || = create | as separator character. - Option2: Button bar - "Tooltip" field: A single space deactivates the display of the tooltip.
If the "Tooltip" field is empty, the content of the "Command" field is displayed. - Option3: See FAQs and explanation: Button-code (TOTALCMD#BAR#DATA) <-- <Ctrl+click on the link...>
wincmd.ini -> section [Configuration]
Code: Select all
CompareTool=Path\to\WinMergeU.exe ... (e.g. %COMMANDER_PATH%\Tools\WinMergePortableZip\WinMergeU.exe)
Button with command: cm_CompareFilesByContent
causes that instead of the internal comparison tool of Total Commander (cm_IntCompareFilesByContent)
the comparison tool WinMerge (cm_CompareFilesByContent) can be used in Total Commander.
Re: Compare by content: Possible to ignore first n lines?
2tuska
The WinMerge command line switch /l doesn't do what the poster wants.
It only positions the cursor on the line number in the GUI
but doesn't ignore lines from the comparision.
The only tool I found so far which such a function is Beyond Compare which is not free.
The WinMerge command line switch /l doesn't do what the poster wants.
It only positions the cursor on the line number in the GUI
but doesn't ignore lines from the comparision.
The only tool I found so far which such a function is Beyond Compare which is not free.
Windows 11 Home, Version 24H2 (OS Build 26100.4061)
TC 11.55 RC2 x64 / x86
Everything 1.5.0.1391a (x64), Everything Toolbar 1.5.2.0, Listary Pro 6.3.2.88
QAP 11.6.4.4 x64
TC 11.55 RC2 x64 / x86
Everything 1.5.0.1391a (x64), Everything Toolbar 1.5.2.0, Listary Pro 6.3.2.88
QAP 11.6.4.4 x64
Re: Compare by content: Possible to ignore first n lines?
Thank you for pointing this out.Horst.Epp wrote: 2022-06-08, 17:40 UTC 2tuska
The WinMerge command line switch /l doesn't do what the poster wants.
It only positions the cursor on the line number in the GUI
but doesn't ignore lines from the comparision.
The only tool I found so far which such a function is Beyond Compare which is not free.
Unfortunately, I misunderstood.
