title: use of AWK for obtaining non negative value
body: <p>I am trying to make my second column as non negative as some of the values are positive and some negative, so trying AWK function.</p>
  
  <p>I have six columns in my bed file I am using the following command </p>
  
  <pre><code>awk -F"\t"  '{print $1"\t"$2&lt;0?$2*-1:$2"\t"$3"\t"$4"\t"$5"\t"$6}' CTCF_first_coordinates &gt; CTCF_first_coordinates_new
  </code></pre>
  
  <p>My problem is when I run this, then my first column is not printed and the values are not converted to non negative. However if i don't print my first column the code works.</p>
  
  <p>Can anybody suggest how can I improve my code to get the proper output?</p>
  
  <p>Below is the input bed file which is tab delimited and second column contain negative values together with positive values</p>
  
  <pre><code>chr18 576980 586980 CETN1 CLUL1 M1 
  chr18 -8280 1720 NA USP14 M1
  </code></pre>
  
  <p>and the output i need is below where I want the negative value to be positive and rest everything remains same</p>
  
  <pre><code>chr18 576980 586980 CETN1 CLUL1 M1 
  chr18 8280 1720 NA USP14 M1
  </code></pre>
  
  <p>In addition to the above problem I have some more issue where the output file as shown above the first coordinate is larger than the second coordinate. Is there any method to interchange the selected values of the two columns in the file i.e column 2 and 3. I have 192 such instances in the whole file. So my output should be something like</p>
  
  <p>chr18 576980 586980 CETN1 CLUL1 M1 
  chr18 1720   8280  NA USP14 M1</p>