Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Based on the following:</p> <blockquote> <p>I'd like to say: "Look in checkA, filename1 is also in checkB albeit a different name" (same checksum)</p> </blockquote> <p>If you have two files with filename and checksum values then you can try something like this:</p> <pre><code>awk -F'=' 'NR==FNR{a[$2]=$1;next} $2 in a{print a[$2],$1,FS,$2}' checkA checkB </code></pre> <h3>Test:</h3> <pre><code>$ cat checkA MD5 (A/fee) = 2737b49252e2a4c0fe4c342e92b13285 MD5 (A/fie) = df8b712c4fe20a0df933819665770165 MD5 (A/foo) = 51ca4befb7cb5bd22766a33c73ffca5b MD5 (A/fum) = a80b2c31cfc269e4aa2f48658b5349d9 $ cat checkB MD5 (B/Bee) = b026324c6904b2a9cb4b88d6d61c81d1 MD5 (B/Bie) = 2737b49252e2a4c0fe4c342e92b13285 MD5 (B/Boo) = df8b712c4fe20a0df933819665770165 MD5 (B/Bum) = 51ca4befb7cb5bd22766a33c73ffca5b $ awk -F'=' 'NR==FNR {a[$2]=$1; next} $2 in a { print a[$2], $1, FS, $2}' checkA checkB MD5 (A/fee) MD5 (B/Bie) = 2737b49252e2a4c0fe4c342e92b13285 MD5 (A/fie) MD5 (B/Boo) = df8b712c4fe20a0df933819665770165 MD5 (A/foo) MD5 (B/Bum) = 51ca4befb7cb5bd22766a33c73ffca5b </code></pre> <h3>Update:</h3> <p>You can use <code>gawk</code> to get your desired output by using <code>gensub</code> function. </p> <pre><code>$ gawk -F'=' 'NR==FNR {a[$2]=$1; next} $2 in a {print a[$2]=gensub(/.*\(([^)]+)\)/,"\\1","G",a[$2]), $1=gensub(/.*\(([^)]+)\)/,"\\1","G",$1), FS, $2}' checkA checkB A/fee B/Bie = 2737b49252e2a4c0fe4c342e92b13285 A/fie B/Boo = df8b712c4fe20a0df933819665770165 A/foo B/Bum = 51ca4befb7cb5bd22766a33c73ffca5b </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload