打印预期的结果在下面awk
我预计增加NR==2
只打印支票二号线$1
值时,1
并确保它是一个数字。如果是,则打印Index is a number
其他 Index is not a number
。它似乎很接近,但结果不是预期的......也许我使用了错误的变量?谢谢 :)。AWK不是从文件
file.txt的
Index Chr Start End Ref Alt Quality Freq Score HGMD
1 1 10 100 A - GOOD .002 2 .
2 1 100 1000 - C STRAND BIAS .036 10 .
3 5 50 500 AA T GOOD 1 5 .
AWK
awk -F'\t' 'NR==2 $1 ~ /^[[:digit:]]/ {print "Index is a number"} ELSE {print "Index is not a number"}' file.txt
Index is a number
Index is a number
Index is a number
Index is a number
Index is a number
期望的输出
Index is a number
你从哪里得到的想法,所有的大写'ELSE'是awk语言结构? –