Absolute value in awk doesn't work?

前端 未结 4 886
臣服心动
臣服心动 2021-01-07 19:56

I want to select line of a file where the absolute value of column 9 is less than 500. Column is sometimes positive, sometimes negative.

awk -F\'\\t\' \'{ if         


        
4条回答
  •  孤街浪徒
    2021-01-07 20:05

    For quick one-liners, I use this approach:

    awk -F'\t' 'sqrt($9*$9) < 500' > output.bam
    

    It's quick to type, but for large jobs, I'd imagine that sqrt() would impose a performance hit.

提交回复
热议问题