New answers tagged

2

If files are exactly the same, then their md5sums will be exactly the same, so you can use: find A/ B/ -type f -exec md5sum {} + | sort | uniq -w32 -D An md5sum is always exactly 128 bits (or 16 bytes or 32 hex digits) long, and the md5sum program output uses hex digits. So we use the -w32 option on the uniq command to compare only the first 32 ...


1

I think this will get you close. It will list out the cmp output for all files named results in A compared to all files named results in B. find ./A -name results | xargs -I REPLACESTR find ./B -name results -exec cmp REPLACESTR {} \;


2

The seeming challenges of the question / request is perhaps the recursion aspect. Assuming that cmp is an adequate utility and that both folder / directories 1 & 2 to be compared are of the same structure (ie same files & folders) and reside within the same root path - you can try something similar to: #!/bin/bash ROOT=$PWD ; # #// change to ...


0

assuming file1 has $BlankValue="TEST"; and file2 has $BLANKValue='TEST'; and you want to ignore both case and quote differences, use diff <(tr 'a-z' 'A-Z' < file1) <(tr "a-z'" "A-Z\"" < file2) if you do not want to ignore case, and ignore only quotes, use diff file1 <(tr "'" "\"" < file2)


0

If you'd prefer a more visual approach in you terminal session. The midnight commander has a remote file system option (SFTP link... option in the menu) and visual file compare option. It is not installed by default on most Linux systems but is available in most base repositories. Steps: Start midnight commander (command: mc) in the folder containing the ...


0

Any decent editor is able to highlight diffs conveniently. You can generally persuade your editor by using the .diff extension, or by setting the filetype to diff otherwise.


1

You could hack something together that would read a line of the file, check the first char on the line, and print it in the appropriate color: green if the first char is a +, red if the first char is a -, and the default color (white? black?) otherwise. "Friendly" terminal color names in shell scripts? Handling the cyan @@ lines would be ...


1

sed -r -e 's/^(.+)pid [0-9]+(.+)$/\1pid-xxxx\2/;' -i /tmp/hello2.log or filter it same way from output.


3

One could log the outputs of the different pids to different files via the -ff -o filename options: strace -o foo -ff -e open perl -e fork strace -o bar -ff -e open perl -e fork and then compare the appropriate foo.<pidnum> and bar.<pidnum> files.


0

The rsync way given by Thane with Yamaneko additions work great but leave empty directories. For me the final solution was in two steps, first call rsync with full path, then a find command to remove all empty directories: rsync -rvcm --compare-dest=/tmp/org/ /tmp/new/ /tmp/difference/ find /tmp/difference/ -d -type d -empty -exec rmdir {} \; -print ...



Top 50 recent answers are included