Compare Files
Attention: To run this script, you are required to
purchase a special scripting commercial license.
The Compare Files script
(compareFiles.sh) can be used to compare two files and get the comparison
results in various formats.
Arguments for the Compare Files Script
sh scripts/compareFiles.sh firstFilePath secondFilePath [[-alg comparisonAlg] [-als algStrength] [-iws ignoreWS] [-ipi ignorePI] [-icm ignoreComments] [-icd ignoreCDATA] [-idt ignoreDocType] [-itn ignoreText] [-ins ignoreNS] [-ind ignoreNSDecl] [-inp ignorePrefixes] [-iao ignoreAttrOrder] [-iee ignoreExpStateForEmptyElems] [-enx XPathExprToExcludeNodes] [-out outputFormat]] [-help | --help | -h | --h]
- firstFilePath
- Mandatory argument that specifies the first file path.
- secondFilePath
- Mandatory argument that specifies the second file path.
- -alg comparisonAlg
- Specifies the algorithm to be used for the comparison. Possible values: auto, chars, words, lines, syntax_aware, xml_fast, and xml_accurate. Default value = auto.
- -als algStrength
- Specifies the strength of the algorithm to be used for the comparison. Possible values: low, medium, high, and very_high. Default value = medium.
- -iws ignoreWS
- If set to true, whitespaces are ignored if differences consist only of whitespaces. Default value = false.
- -ipi ignorePI (only for the XML-aware algorithms)
- If set to true, processing instructions are ignored in the comparison. Default value = false.
- -icm ignoreComments (only for the XML-aware algorithms)
- If set to true, comments are ignored in the comparison. Default value = false.
- -idt ignoreDocType (only for the XML-aware algorithms)
- If set to true, DOCTYPE sections are ignored in the comparison. Default value = false.
- -itn ignoreText (only for the XML-aware algorithms)
- If set to true, text content is ignored in the comparison. Default value = false.
- -ins ignoreNS (only for the XML-aware algorithms)
- If set to true, namespaces are ignored in the comparison. Default value = false.
- -ind ignoreNSDecl (only for the XML-aware algorithms)
- If set to true, namespace declarations are ignored in the comparison. Default value = false.
- -inp ignorePrefixes (only for the XML-aware algorithms)
- If set to true, prefixes are ignored in the comparison. Default value = false.
- -iao ignoreAttrOrder (only for the XML-aware algorithms)
- If set to true, the order of attributes is ignored in the comparison. Default value = false.
- -iee ignoreExpStateForEmptyElems (only for the XML-aware algorithms)
- If set to true, the expansion state for empty elements is ignored in the comparison. Default value = false.
- -enx XPathExprToExcludeNodes
- Specifies an XPath expression to exclude certain nodes from the comparison.
- -out outputFormat
- Specifies the format of the output files. Possible values: yaml, json,
or xml. Default value = yaml.Note: If you choose to redirect the console output to a file, this argument establishes the type of the output file and its content is formatted accordingly.
- -help | --help | -h | --h
- Displays help text.
Note: For boolean arguments, it is not necessary to provide the "true"
value. Their presence in the argument list is equivalent to setting their value to "true"
(and their absence from the argument list is equivalent to setting their value to "false").
However, constructs of the form
bool_option true|false are accepted and
interpreted accordinglyExamples of Compare Files Script
-
sh scripts/compareFiles file1 file2 -ins -inp -ind -out xml > results.xml
Compares the files (ignoring the namespaces and prefixes) and redirects the console output to the results.xml file (XML-formatted).
-
sh scripts/compareFiles.sh file1 file2 -alg lines -iws
Compares the files using the lines algorithm and ignores whitespaces.