#] #] ********************* #] "$d_SysMaint""Linux/diff notes.txt" www.BillHowell.ca date? initial #] see also "/media/bill/PROJECTS/System_maintenance/Linux/lists compare - diff & comm.txt" #] "$d_bin"'diff directories.sh' 24************************24 08********08 # Table of Contents, generated with : # $ grep "^#]" "$d_SysMaint""Linux/diff notes.txt" | sed 's/^#\]/ /' # ********************* "$d_SysMaint""Linux/diff notes.txt" diff actually sucks for general text file comparisions, use only for small changes without re-ordering WARNING : do BOTH!! different information : diff "$pinn1" "$pinn2" --suppress-common-lines | grep "^<" | sed 's/^< //' diff "$pinn2" "$pinn1" --suppress-common-lines | grep "^<" | sed 's/^< //' with diff, you MUST change the ordering of the files to check from differnt perspectives!! also, don't mix [bash, QNial] sorts, as they do not give the same results! -y option : (side-by-side), use with --suppress-common-lines diff "path1" "path2" --suppress-common-lines | grep --invert-match "[,cd-]" | sed 's/< //;s/> //' >"pDif" diff "$pinn1" "$pinn2" --suppress-common-lines | grep "^<" | sed 's/^< //' >"$pout" diffRes := host_result link 'diff --width=60 "' pinn1 '" "' pinn2 '" --suppress-common-lines' ; diff file2 file1 | grep "^>" | sed "s/^>\ //" find lines of file1 not in file2, SORTED files? comm -12 file1 file2 find lines common to both file1 in file2 find scripts using "diff" (didn't finish) : $ find "/media/bill/PROJECTS/Qnial/MY_NDFS/" -maxdepth 1 -name "*" | tr \\n \\0 | xargs -0 -IFILE grep --with-filename --line-number "diff" "FILE" vimdiff, diff <(rg -N . file1.txt) <(rg -N . file2.txt) for unicode?? 08********08 #] diff actually sucks for general text file comparisions, use only for small changes without re-ordering #] standard : #] diff "$pinn1" "$pinn2" --suppress-common-lines >"$pDif" #] WARNING : do BOTH!! different information : #] diff "$pinn1" "$pinn2" --suppress-common-lines | grep "<" | sed 's/< //' #] diff "$pinn2" "$pinn1" --suppress-common-lines | grep "<" | sed 's/< //' #] with diff, you MUST change the ordering of the files to check from differnt perspectives!! #] sorting - don't mix [bash, QNial] sorts, as they do not give the same results! 16Aug2021 https://www.linuxquestions.org/questions/linux-general-1/how-to-use-diff-to-only-print-lines-654370/ option -y side-by-side https://stackoverflow.com/questions/354526/how-can-i-diff-two-files-with-full-context Or simply diff -U -1 as pointed out by J-L – Gunar Gessner Jun 4 at 9:31 #] -y option : (side-by-side), shows you differences side-by-side, use with --suppress-common-lines 16Aug2021 https://www.howtoforge.com/tutorial/linux-diff-command-options/ diff -y "$d_out" "$d_MindCode""2_MindCode list of NONLOCALs QNial.txt" --suppress-common-lines | grep --invert-match "[,\-]" | grep --invert-match "[0-9][acd][0-9]" | grep --invert-match "#] " #] diff "$path1" "$path2" --suppress-common-lines | grep --invert-match "[,cd-]" | sed 's/< //;s/> //' >"$pDif" #] diff "$pinn1" "$pinn2" --suppress-common-lines | grep "<" | sed 's/< //' >"$pout" 09Jul2019 using diff to remove a list from a list 28Oct2020 NOTE : --suppress-common-lines must come AFTER the filepaths!!! #] diffRes := host_result link 'diff --width=60 "' pinn1 '" "' pinn2 '" --suppress-common-lines' ; QNial version However, --width=85 doesn't seem to work, b don't need it for now #] find lines of file1 not in file2 (SORTED files for some apps) : #] diff file2 file1 | grep "^>" | sed "s/^>\ //" #] find lines common to both file1 in file2 #] comm -12 file1 file2 #] find scripts using "diff" (didn't finish) : #] $ find "/media/bill/PROJECTS/Qnial/MY_NDFS/" -maxdepth 1 -name "*" | tr \\n \\0 | xargs -0 -IFILE grep --with-filename --line-number "diff" "FILE" ************** #] vimdiff, diff <(rg -N . file1.txt) <(rg -N . file2.txt) for unicode?? 13Sep2019 search "Linux diff and problem with unicode" check "Howell - math of Lucas Universal Force.txt" version of 04_34 versus work file : $ diff --width=500 "/media/bill/SWAPPER/Lucas - Universal Force/individual formulae developments/04_34 work file.txt" "/media/bill/ramdisk/04_34 work file.txt" --suppress-common-lines >> diff screws up with unicode!! $ diff --width=85 "/media/bill/SWAPPER/Lucas - Universal Force/individual formulae developments/04_34 work file.txt" "/media/bill/ramdisk/04_34 work file.txt" --suppress-common-lines >> diff screws up with unicode!! EASY - write QNial program to look at diff output! "diff unicode.ndf" +-----+ https://stackoverflow.com/questions/778291/how-do-i-diff-utf-16-files-with-gnu-diff +--+ vimdiff works quite nicely for this purpose. I found it while reading this StackOverflow answer. edited May 23 '17 at 12:02 Community♦ 111 silver badge answered Nov 13 '09 at 11:32 Jean Regisser +--+ Install ripgrep utility which supports UTF-16, then run: diff <(rg -N . file1.txt) <(rg -N . file2.txt) ripgrep supports searching files in text encodings other than UTF-8, such as UTF-16, latin-1, GBK, EUC-JP, Shift_JIS and more. (Some support for automatically detecting UTF-16 is provided. Other text encodings must be specifically specified with the -E/--encoding flag.) edited Jan 17 at 15:08 answered Jan 17 at 13:08 kenorb >> neither approach seems useful for my case ... ************************ 08Feb2019 search "Linux and binary file compare" https://superuser.com/questions/125376/how-do-i-compare-binary-files-in-linux Try diff in the following combination of zsh/bash process substitution and colordiff in CLI: diff -y <(xxd foo1.bin) <(xxd foo2.bin) | colordiff Where: -y shows you differences side-by-side (optional) xxd is CLI tool to create a hexdump output of the binary file colordiff will colorize diff output (install via: sudo apt-get install colordiff) add -W200 to diff for wider output (of 200 characters per line) Hints: if files are too big, add limit (e.g. -l1000) for each xxd edited Jan 30 at 4:22, The Matt answered Sep 5 '15 at 21:14, kenorb If you just want to know whether both files are actually the same, you can use the -q or --brief switch, which will only show output when the files differ. – Stefan van den Akker Oct 8 '16 at 11:14 $ diff --brief <(xxd "/media/bill/PROJECTS/2019 IJCNN Budapest/Publications/2019 papers/N-20406.pdf") <(xxd "/media/bill/PROJECTS/2019 IJCNN Budapest/Publications/2019 papers/N-20406 revised.pdf") 08********08 16Aug2021 'QNial list [,NON]LOCALs.ndf' - fix missing QNial version diff isn't really working with a simp set of word lists!?!? details below "MindCode list of [data, optr,[,NON]local 1st line]s.sh" : diff -y "$d_out" "$d_MindCode""2_MindCode list of NONLOCALs QNial.txt" --suppress-common-lines | grep --invert-match "[,\-]" | grep --invert-match "[0-9][acd][0-9]" | grep --invert-match "#] " $ bash "$d_bin""MindCode list of [data, optr,[,NON]local 1st line]s.sh" bash 1st line only QNial _____________________________________________ > bitCnt_sign > bits_base > bits_expt > bits_sign clus_last < clusList_increment < dendDelayL < dendIdentL < dendInhibL < IDL < IDsubL < inhibL < inHistL < > IDL > IDsubL > n_neur n_clus < netIDL < neur_last < n_neur < NONLOCAL < OKL | NONLOCAL opL < optrL < outTypL < paramL < p_log < realBase_max < realCode < ResCalcL | realBase_max ResCalcLtTitles | realCode ResStdL < sensIDL < subTemp < ToffL < trgrTyp < trigTitles < TwaitL < waitTL | TwaitL wghtL | Xref_rows > XrefNmIDL >> easy to use with -y!! >> NOTE : Works partially. [IDL, IDsubL, n_neur, diff -U -1 "$d_out" "$d_MindCode""2_MindCode list of NONLOCALs QNial.txt" --suppress-common-lines | grep --invert-match "[,\-]" | grep --invert-match "[0-9][acd][0-9]" | grep --invert-match "#] " Best results with -U -1 $ bash "$d_bin""MindCode list of [data, optr,[,NON]local 1st line]s.sh" "$d_out" "$d_MindCode""2_MindCode list of NONLOCALs QNial.txt" axonDelayL axonIdentL axonInhibL bitCnt_base bitCnt_expt bitCnt_intgBase +bitCnt_sign +bits_base +bits_expt +bits_sign clusClassL clusIdentL clusNeurnL cycle_max epigenL fireL fireStdL flag_cycle_output histPatL histPatNowL IDL IDsubL inL inNmIDL intg_high intg_loww modL nameL net_rows neurClassL neurFiredL neurIdentL neurInFireL neurList_increment neurStateL n_neur NONLOCAL nowFireL out outL outs realBase_max realCode real_high real_loww trgrPatL trgrPatNmIDL trgrTypL TwaitL typeL XrefIDL XrefIDsubL +XrefNmIDL XrefNmL +Xref_rows "$d_MindCode""2_MindCode list of NONLOCALs QNial.txt" "$d_out" + axonDelayL axonIdentL axonInhibL bitCnt_base bitCnt_expt bitCnt_intgBase clusClassL clusIdentL +clus_last +clusList_increment clusNeurnL cycle_max +dendDelayL +dendIdentL +dendInhibL epigenL fireL fireStdL flag_cycle_output histPatL histPatNowL IDL IDsubL +inhibL +inHistL inL inNmIDL intg_high intg_loww modL nameL +n_clus +netIDL net_rows neurClassL neurFiredL neurIdentL neurInFireL +neur_last neurList_increment neurStateL n_neur NONLOCAL nowFireL +OKL +opL +optrL out outL outs +outTypL +paramL +p_log realBase_max realCode real_high real_loww +ResCalcL +ResCalcLtTitles +ResStdL +sensIDL +subTemp +ToffL trgrPatL trgrPatNmIDL +trgrTyp trgrTypL +trigTitles TwaitL typeL +waitTL +wghtL XrefIDL XrefIDsubL XrefNmL +-----+ $ find "$d_MindCode" -type f -name "*.ndf" | grep --invert-match "z_Archive" | tr \\n \\0 | xargs -0 -ILINE grep --with-filename "realBase_max" LINE /media/bill/Dell2/Website - raw/Qnial/MY_NDFS/MindCode/bits to-from [intg, real].ndf: NONLOCAL bitCnt_base bitCnt_expt realBase_max ; /media/bill/Dell2/Website - raw/Qnial/MY_NDFS/MindCode/bits to-from [intg, real].ndf: WHILE (base > realBase_max) DO /media/bill/Dell2/Website - raw/Qnial/MY_NDFS/MindCode/data types.ndf:{ NONLOCAL intg_loww intg_high real_loww real_high realBase_max bitCnt_intgBase /media/bill/Dell2/Website - raw/Qnial/MY_NDFS/MindCode/data types.ndf: realBase_max := 31 ; % reals have < 2-digit accuracy! ; /media/bill/Dell2/Website - raw/Qnial/MY_NDFS/MindCode/data types.ndf:{ NONLOCAL intg_loww intg_high real_loww real_high realBase_max bitCnt_intgBase /media/bill/Dell2/Website - raw/Qnial/MY_NDFS/MindCode/data types.ndf: realBase_max := 31 ; % reals have < 2-digit accuracy! ; +-----+ $ find "$d_MindCode" -type f -name "*.ndf" | grep --invert-match "z_Archive" | tr \\n \\0 | xargs -0 -ILINE grep --with-filename "NONLOCALintg_high" LINE >> nothing +-----+ $ find "$d_MindCode" -type f -name "*.ndf" | grep --invert-match "z_Archive" | tr \\n \\0 | xargs -0 -ILINE grep --with-filename "80a61" LINE >> nothing??!? # enddoc