Issue
I'd like to display the file and version number for different services. For example there might be a line in the text file that says nginx 1.13.0
. I'd like to be able to search every single instance of nginx [0-9].[0-9].[0-9]
and have it displayed with the version number and file name / line.
I've already tried this command which works well for displaying the matched files:
grep -lrEH "nginx [0-9].[0-9].[0-9]"
Solution
You are close, missing that it might be more than one digit +
. You should also escape the .
, so it mean only .
and not any character.
Try:
grep -EHro "nginx [0-9]+\.[0-9]+\.[0-9]+"
Answered By - Jotne Answer Checked By - Marilyn (WPSolving Volunteer)