title: AWK Script along with loop and if condition
body: <p>The input file is as below</p>
  
  <pre><code>827 819
  830 826
  828 752
  756 694
  828 728
  821 701
  724 708
  826 842
  719 713
  764 783
  752 828
  694 756
  </code></pre>
  
  <p><code>#$1</code> is my first row and $2 is my second row. I am trying to omit rows such as 11th row which is the same as the 3rd row but with swapped values. Basically, for every $1 $2 that also has $2 $1, I want to omit the latter. This is just a snippet of the data. There are many such values in the actual dataset.`</p>
  
  <p>I have tried the below:</p>
  
  <pre><code>awk -F “ “ ‘{ for i in cat 686.edges.txt | if [ expr $1 $2 == expr $2 $1 ] then #Evaluating the condition from file
  </code></pre>
  
  <p>and</p>
  
  <pre><code>awk -F “ “ ‘{ print $2  $1 }’ &gt;&gt; t.txt else ‘{ print “ Not found “ } fi #Printing all the $y $x into a file
  </code></pre>
  
  <p>and</p>
  
  <pre><code>awk -F “ “ ‘{ for i in cat t.txt} | grep -v "$1 $2" 686.edges.txt &gt;&gt; new.txt
  </code></pre>
  
  <p>I am reading inputs from t.txt which is the result of the previous operation and removing all of them from the main file and writing it in new.txt</p>
  
  <p>I am unable to execute as I have been getting errors. Can anybody evaluate the above and correct me.</p>