Using awk, how I do specify doing something only when the first field is an integer? -
i starting out in awk, , wonder, using awk, proper way state, (such printing out record) when first field integer?
do ... when first field integer?
this command in braces, print
in case, if first field positive integer:
awk '$1 ~ /^[[:digit:]]+$/{print;}'
floating point numbers rejected.
if want accept either positive or negative integers, then, mklement0 suggests, use following:
awk '$1 ~ /^[+-]?[[:digit:]]+$/{print;}'
note that, because [:digit:]
used, these tests unicode safe.