In a file 4th column contai开发者_开发问答ns a floating point numbers
dsfsd sdfsd sdfds 4.5 dfsdfsd
I want to delete the entire line if the number between -0.1 and 0.1 (or some other range).
Can sed or awk do that for me?
thanks
I recommend using the "pattern { expression }" syntax:
awk '($4 < -0.1) || ($4 > 0.1) {print}' test.txt
Or, even more concicely:
awk '($4 < -0.1) || ($4 > 0.1)' test.txt
Since {print} is the default action. I've assumed that you have a file "test.txt" containing your data.
awk:
{ if ($4 > 0.1 || $4 < -0.1) print $0 }
精彩评论