Tag Info

New answers tagged


Maybe this is not helpful in your exact case, but I often simply use sum -r on each machine, and manually compare the checksums. That allows for comparisons of files even when they are not reachable via an ssh connection. Of course, all it answers is "are they identical", but often that is sufficient for my needs. It also makes it easy to verify that a ...


Try: diff local_file <(ssh user@server 'cat remote_file') or using vimdiff: vimdiff local_file scp://server//path/to/remote_file


ssh user@remote_host "cat remote_file.txt" | diff - local_file.txt Source


The less command by itself cannot do any diff'ing. You can use the diff -y command to show the diff of 2 files side-by-side and then pipe that into less however. Method #1 - using diff + less This will create 2 sample files. $ seq 100 > 1.txt $ seq 10 100 > 2.txt Now diff the 2 files: $ diff -y 1.txt 2.txt | less 1 ...


I am not sure if it is possible using less command. However, it is possible using the below command. From here, pr -m -t one.txt two.txt One more option that is useful though doesn't display side by side is, tail -f file1 -f file2


You have to add one more option : grep -vf file1 file2


This will be very slow for large files, but you could do $ while read a rest; do grep -w $a file2; done < file1 aaa a m bbb m a ccc m m A faster way, in Perl: $ cat file1 | perl -lane '$k{$F[0]}=$_; END{ open(A,"file1"); while(<A>){/^(.+?)\s/; print $k{$1}} }' file2 aaa a m bbb m ...


Try this: $ awk 'FNR==NR{a[$1]=$0;next} {print a[$1]}' file2 file1


I think this ought to do what you need: diff -r -U0 a/ b/ | awk '/^+++ / {filename=$2; next} /^@@ / {split($3,a,","); line=substr(a[1],2)} /^+/ {text=substr($0,2); print filename ":" line ":" text; line++}' Basically, it does an ordinary recursive diff, and then discards the bit you don't want. awk is cool for stuff like this. diff -U0 gives output like ...

Top 50 recent answers are included