How Do I Grep a Number in Linux?
Contents How Do I Grep a Number from the Line? the -N ( or –Line-Number ) Option Tells Grep to Show the Line Number of the Lines Containing a String That...
How do I grep a number from the line?
The -n ( or –line-number ) option tells grep to show the line number of the lines containing a string that matches a pattern. When this option is used, grep prints the matches to standard output prefixed with the line number. The output below shows us that the matches are found on lines 10423 and 10424.
Must Read
How do I grep only numbers in Unix?
grep will print any lines matching the pattern you provide. If you only want to print the part of the line that matches the pattern, you can pass the -o option: -o, –only-matching Print only the matched (non-empty) parts of a matching line, with each such part on a separate output line.