Answer the question
In order to leave comments, you need to log in
How to find lines containing url using regular expressions in linux?
How to find lines containing url using regular expressions in linux?
With the grep command
I tried like this grep "[http\:]\+[a-zA-z0-9]+\.[az]\{2,4\}" /etc/
writes the wrong range
Answer the question
In order to leave comments, you need to log in
grep -rE 'https?://[a-zA-Z0-9][\.a-zA-Z0-9-]{1,61}[a-zA-Z0-9]\.[a-zA-Z]{2,}' /etc
Of course, incorrect - it should be like this:[a-zA-Z0-9]
Well, for starters - this pattern cannot be enclosed in double quotes, apostrophes are needed here - because quotes do not escape backslashes.
Then the entry "[http\:]" raises suspicion - probably, the whole string "http" is needed here, and not "any of the letters".
About "Az" they said here.
"/etc/" is a search in the body of the directory, i.e. among filenames (rather than in file bodies).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question