Just use regex [0-9]+ for matching a number of more than one digit. For example: grep "[0-9]\+" file.txt