How to search lines containing numbers in Linux

We can use grep command with a regular expression to search lines containing numbers.

#grep -w '[0-9]\{n\}' filename

Here we need to replace 'n' with the number of digits that we need to search.

 

Leave a Reply

Your email address will not be published. Required fields are marked *