title: Compare Hex Numbers in Shell
body: <p>I want to compare the first element of every line in A.txt with the the first element of B.txt lines and if they match print that line of A.
  Both first line elements of A and B are hexadecimal numbers and I have written the following code based on <a href="https://askubuntu.com/questions/366879/awk-comparing-the-value-of-two-variables-in-two-different-files">https://askubuntu.com/questions/366879/awk-comparing-the-value-of-two-variables-in-two-different-files</a>.</p>
  
  <pre><code>#!/bin/bash
  A="$HOME/A.txt"
  B="$HOME/B.txt"
  
  cat $A | while read a; do
  a1=$(echo $a | awk ' { print $1 }')
      cat $B | while read b; do
          b1=$(echo $b | awk ' { print $1 }')
          if [ $a1 == $b1 ]; then
              echo $a
          fi
      done
  done
  </code></pre>
  
  <p>Here is what I get: 
  line 9: [0x6200e001: command not found</p>