Match Lines with No Digits Using grep and Regex
Match lines that contain no digits with ^[^0-9]*$, or invert a plain digit search with grep -v. The star also accepts an empty line, so use a plus to require text.
You want the lines of a file that have no number in them at all.
printf '%s\n' abc a1c '' 123 x-y > lines.txt
grep -nE '^[^0-9]*$' lines.txt
echo "--- same with -v"
grep -nvE '[0-9]' lines.txt
echo "--- nonempty only"
grep -nE '^[^0-9]+$' lines.txt1:abc
3:
5:x-y
--- same with -v
1:abc
3:
5:x-y
--- nonempty only
1:abc
5:x-yThe bracket [^0-9] matches any character except a digit, and the anchors ^ and $ force the whole line to consist of such characters, so abc, an empty line and x-y pass and a1c and 123 do not. grep -v '[0-9]' gives the same result without the anchors, because it shows the lines where the digit search finds nothing. With a plus instead of a star the empty line is rejected, as the last part of the run shows. See Regular Expressions in the grep manual.
Inverting with -v is clearer for one condition, and the anchored form is needed when the test is part of a larger pattern. In locales other than C, [0-9] can match digits of other scripts in some engines, and [[:digit:]] states the intent.