Compare-Object -ReferenceObject $(Get-Content f1.txt) -DifferenceObject $(Get-Content f2.txt)
COOKIES! This blog uses cookies!
I am completely out of control of cookies here, otherwise I would have disabled them (it is controlled by the platform).
If you don't like cookies and being tracked please leave this blog immediately.
Showing posts with label diff. Show all posts
Showing posts with label diff. Show all posts
Saturday, 30 June 2018
Diff two files with powershell
Monday, 30 May 2016
Produce html diff with diff2html-cli
It is handy to do with one nice JavaScript tool, which works on any platform:
https://www.npmjs.com/package/diff2html-cli
> npm install diff2html-cli
> diff -u fileA.txt fileB.txt | diff2html -F diff.html -i stdin
It is important to have -u option for diff command you pipe into diff2html, because it produces unified diff and diff2html expects unified diff.
It is also possible to do these two commands separatedly, without piping:
Write diff of a and b into a-b.diff file:
> diff -u a.txt b.txt > a-b.diff
Produce HTML file from the diff file:
> diff2html -F a-b.html -i file -- a-b.diff
https://www.npmjs.com/package/diff2html-cli
> npm install diff2html-cli
> diff -u fileA.txt fileB.txt | diff2html -F diff.html -i stdin
It is important to have -u option for diff command you pipe into diff2html, because it produces unified diff and diff2html expects unified diff.
It is also possible to do these two commands separatedly, without piping:
Write diff of a and b into a-b.diff file:
> diff -u a.txt b.txt > a-b.diff
Produce HTML file from the diff file:
> diff2html -F a-b.html -i file -- a-b.diff
Friday, 16 May 2014
copy all GIT diff files on windows
Windows CMD one-line command to copy difference of two GIT commits into specific directory preserving directories hierarchy:
*xcopy will ask you to confirm wither the path is file or directory for each of your changed files. As far as diff returns only files changed, you can just do long F button press :-) Unfortunately I did not succeed to find a flag to suppress this warning with F option.
It consists of following subcommands:
1. git diff --name-only yrc0m1 yrc0m2 - returns list of changed files between commits yrc0m1 and yrc0m2;
2. sed s:/:\\:g - piped with | after previous one, converting Linux slashes to windows slashes;
3. > report.txt - oputput of previous two commands: all relative filepaths are saved in report.txt;
4. for /F %F in ('cat report.txt') do xcopy %F c:\m1m2diff\%F - iterates through lines in report.txt and copying file creating all not-existing directories from it's relative path (we suppose that c:\m1m2diff\ directory already exists)
5. del report.txt - simply deletes report.txt file.
git diff --name-only yrc0m1 yrc0m2|sed s:/:\\:g > report.txt && for /F %F in ('cat report.txt') do xcopy %F c:\m1m2diff\%F && del report.txt
*xcopy will ask you to confirm wither the path is file or directory for each of your changed files. As far as diff returns only files changed, you can just do long F button press :-) Unfortunately I did not succeed to find a flag to suppress this warning with F option.
It consists of following subcommands:
1. git diff --name-only yrc0m1 yrc0m2 - returns list of changed files between commits yrc0m1 and yrc0m2;
2. sed s:/:\\:g - piped with | after previous one, converting Linux slashes to windows slashes;
3. > report.txt - oputput of previous two commands: all relative filepaths are saved in report.txt;
4. for /F %F in ('cat report.txt') do xcopy %F c:\m1m2diff\%F - iterates through lines in report.txt and copying file creating all not-existing directories from it's relative path (we suppose that c:\m1m2diff\ directory already exists)
5. del report.txt - simply deletes report.txt file.
Subscribe to:
Posts (Atom)