Вопрос

I wanted to use grep to show only the URL's in a text file. I have tried to use:

grep "http://www\.[[:alpha:]]\.[[:alpha:]]"

I didn't get any results although there are URL's in the text file.

Also, how can i make it works for HTTPS also??

Thanks!

Это было полезно?

Решение

You need to use the + modifier here meaning the preceding item will be matched one or more times.

grep 'http://www\.[[:alpha:]]\+\.[[:alpha:]]\+' file
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top