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

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.

Related

Beyond compare in command line

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.

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

Check if Windows batch variable starts with a specific string

How can I find out (with Windows a batch command), if, for example, a variable starts with ABC?
I know that I can search for variables if I know the whole content (if "%variable%"=="abc"), but I want that it only looks after the beginning.
I also need it to find out where the batch file is located, so if there is a other command that reveals the file's location, please let me know.
Use the variable substring syntax:
IF "%variable:~0,3%"=="ABC" [...]
If you need the path to the batch file without the batch file name, you can use the variable:
%~dp0
Syntax for this is explained in the help for the for command, although this variable syntax extends beyond just the for command syntax.
to find batch file location use %0 (gives full patch to current batch file) or %CD% variable which gives local directory

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

How to Input Redirect Two Files to Standard Input?

Is it possible to redirect two or more files to standard input in one command? For example
$ myProgram < file1 < file 2
I tried that command however, it seemed like the OS is only taking the first file and ignoring the other...
If not, how can I achieve that?
NOTE: concatenating the two files will not help in my case.
When you do this from bash, it isn't inputting multiple files to standard input, it is called Process Substitution
The output is sent to an file descriptor under /dev/fd/<n> for each substitution