title: awk, save lines with the same value of a specific column
body: <p>I want to compare with AWK the values in column 7 between lines and save the lines in a file with the same value of the column 7. Then when the value change to save it in a new file ...</p>
  
  <pre><code>chr18   57650444    57650444    0   3.5 ST  mW1 chr18   57646426    57803315    
  chr18   57668180    57668180    0   2.4 ST  mW1 chr18   57646426    57803315
  chr18   57668180    57668180    0   2.4 ST  mW2 chr18   57646426    57803315
  chr18   57650444    57650444    0   3.5 ST  mW1 chr18   57646426    57803315    
  chr18   57650444    57650444    0   3.5 ST  mE3 chr18   57646426    57803315    
  </code></pre>
  
  <p>I have to use isolate the column 7, like <code>awk '{print $7}'</code> and at the same time read the line <code>NR</code> and <code>NR-1</code>, finally compare the values of the 7th column between the first and second column and use "if", <code>awk '{if (NR-1 == NR) print NR}' inputfile &gt;&gt; "value_column_7".txt</code>
  ... I think something like this ...</p>
  
  <p>What I want</p>
  
  <pre><code>filename: mW1.txt
      chr18   57650444    57650444    0   3.5 ST  mW1 chr18   57646426    57803315    
      chr18   57668180    57668180    0   2.4 ST  mW1 chr18   57646426    57803315
      chr18   57650444    57650444    0   3.5 ST  mW1 chr18   57646426    57803315    
  
  filename: mW2.txt
      chr18   57668180    57668180    0   2.4 ST  mW2 chr18   57646426    57803315
  
  filename: mE3.txt
      chr18   57650444    57650444    0   3.5 ST  mE3 chr18   57646426    57803315    
  </code></pre>
  
  <p>Could you help me how to combine them?
  Thanks</p>