If we can assume that the first field contains only numbers:
awk 'length($1) == 3' file1
If not, go to one of the regex solutions.
Alternative solution:
awk '$1 >= 100 && $1 <= 999' file1
print the entire line where the numerical value of the first field is in the range (100,999). This decision has two reservations:
100aapconverted to 100and printed.005Converts to 5and does not print.
schot source
share