Beyond compare in command line - beyondcompare4

I'm using Beyond Compare 4 from the command line to compare to files, which generates output report with differences. But, I'm not able to display the line numbers of differences. I used following script:
file-report layout:side-by-side options:display-mismatches output-to:%3 output-options:html-color,wrap-word %1 %2
Please suggest, how can I display the line number in report.

Use the line-numbers report option to include line numbers in a side-by-side report.
file-report layout:side-by-side options:display-mismatches,line-numbers output-to:%3 output-options:html-color,wrap-word %1 %2
See the Scripting Reference topic in Beyond Compare 4's help file for a full description of all file-report options.

Related

Compare Multiple Files in Beyond Compare

I have multiple files in a folder and essentially want all of them to be compared with 1 main file. How do I go on about in doing this as it's only limited to two files opened at once?
Thanks.
Beyond Compare is limited to 2-way comparison. If the main file and the other files are all located in the same folder, load the folder in the Folder Compare. Then select the main file and one of the other files. Right click and select Open to launch the two files in the Text Compare. Repeat for each file that must be compared to main.
Beyond Compare also includes support for command-line scripting you can use to automate the comparison.
Example script to compare main to 3 files and output comparison results as HTML:
text-report layout:side-by-side options:ignore-unimportant,display-mismatches output-to:out1.html output-options:html-color c:\main.txt c:\1.txt
text-report layout:side-by-side options:ignore-unimportant,display-mismatches output-to:out2.html output-options:html-color c:\main.txt c:\2.txt
text-report layout:side-by-side options:ignore-unimportant,display-mismatches output-to:out3.html output-options:html-color c:\main.txt c:\3.txt
To run the script, use the command line:
bcompare.exe #c:\script.txt
The # character makes Beyond Compare run a file as a script instead of loading it for interactive comparison.
Beyond Compare Scripting Resources:
Help File > Scripts
Help File > Scripting Reference
Scripting Forum

How to report only differences in RIGHT SIDE text comparison with Beyond Compare?

I am using Beyond Compare 4 to compare 2 text files. I run BCompare.exe in the Windows command line and run this script:
# Script.txt
select right.diff
text-report layout:side-by-side options:display-mismatches output-to:"%3" "%1" "%2"
My layout option is side-by-side, but I do not actually want this. I want the output report to show ONLY differences from the RIGHT SIDE.This is what I was attempting to do in the first line select right.diff, but from what I know, that command is used for folder comparisons, not text.
Does anyone know how to accomplish this?
Note:
The %1, %2, %3 refers to the file locations of the arguements I pass into the command line. %3 is my output file, %1 is left input file and %2 is right input file.
Beyond Compare doesn't provide a method to output only one side in a report. A report layout that only outputs one side is on the feature wish list for a future version, but it doesn't have a scheduled release date.

Moving the "cursor" back a line for stdout

I have a little command line tool (written in Objective C, runs under MacOS) that tracks changes to folders and applies rules to files. This tool also informs the user about the progress. It says like:
"Found 3 files of type Z and applied rule"
"Found 6 files of typ x and applied rules"
Currently, the tool outputs the feedback as an endless list but this does not look very handy. What I'm after is a solution to only type the line per file type once and then update the number in the terminal if the tool finds another file of that type. Very similar to how "top" under Unix gives the feedback.
However, to do so, I'll need to move the cursor in the terminal backwards to the beginning of the line and also one or multiple lines backwards.
Is this possible and does anybody know, how to do so?
Thanks
Norbert

Windows batch script to extract number from HTML code?

I am looking for some code to extract a number which is expected to be from one to four digits in length from some HTML code. I have pulled the web page using cURL and used FIND to extract the single line of information I need, but I would like the output to be much cleaner.
Here is an example of the HTML line I'm dealing with:
constant_text_here 123 constant_text</h2></td>
Does that html code mess things up for batch scripting? I know nothing about scripting with Windows Batch code. The number can remain as a string, but it is expected to be between one and four digits.
#ECHO OFF
SETLOCAL
FOR /f "tokens=2" %%a IN (q25614455.txt) DO SET var=%%a
ECHO var=%var%
pause
GOTO :EOF
I used a file named q25614455.txt containing your data for my testing. Sadly, you don't reveal what constant_text_here actually is, so honing the procedure is in your bailiwick. The number following tokens= will pick a string from the text supplied in the file; had your text been constant text here for instance, you'd need to change tokens=2 to tokens=4.
It would also likely be possible to include your curl/find into the procedure and extract your target data in one line, but without sufficient details, a vague general question can at best
garner a vague response.
The < and > will give you trouble as they're used to redirect output.
Is using VBscript a possibility?
From the command line:
C:\>set myvar=constant_text_here 123 constant_text</h2></td>
will output:
< was unexpected at this time.
but this will work:
C:\>set myvar="constant_text_here 123 constant_text</h2></td>"
C:\>echo %myvar%
"constant_text_here 123 constant_text</h2></td>"
C:\>echo [%myvar:~20,4%]
[123 ]
Assuming what interests you can always be found at position 20

Display variables using CBC MPS input in NEOS

Am trying to use NEOS to solve a linear program using MPS input.
The MPS file is fine, but apparently you need a "paramaters file" as well to tell the solver what to do (min/max etc.). However I can't find any information on this online anywhere.
So far I have got NEOS to solve a maximization problem and display the objective function. However I cannot get it to display the variables.
Does anyone know what code I should add to the paramters file to tell NEOS/CBC to display the resulting variables?
The parameter file consists of a list of Cbc (standalone) commands in a file (one per line). The format of the commands is (quoting the documentation):
One command per line (and no -)
abcd? gives list of possibilities, if only one + explanation
abcd?? adds explanation, if only one fuller help(LATER)
abcd without value (where expected) gives current value
abcd value or abcd = value sets value
The commands are the following:
? dualT(olerance) primalT(olerance) inf(easibilityWeight)
integerT(olerance) inc(rement) allow(ableGap) ratio(Gap)
fix(OnDj) tighten(Factor) log(Level) slog(Level)
maxN(odes) strong(Branching) direction error(sAllowed)
gomory(Cuts) probing(Cuts) knapsack(Cuts) oddhole(Cuts)
clique(Cuts) round(ingHeuristic) cost(Strategy) keepN(ames)
scaling directory solver import
export save(Model) restore(Model) presolve
initialS(olve) branch(AndBound) sol(ution) max(imize)
min(imize) time(Limit) exit stop
quit - stdin unitTest
miplib ver(sion)
To see the solution values, you should include the line sol - after the min or max line of your parameter file.
If this doesn't work you can submit the problem to NEOS in AMPL format via this page. In addition to model and data files, it accepts a commands file where you can use statements to solve the problem and display the solution, for example:
solve;
display _varname, _var;
This post describes how to convert MPS to AMPL.