On Wed, Jul 13, 2016, 21:11 Chris Adams <li...@cmadams.net> wrote:

> Once upon a time, Mike Wright <nob...@nospam.hostisimo.com> said:
>
> Putting all that together, I'd recommend:
>
>   PATTERN='https?://[^/]*\.in/'
>   grep "$PATTERN" file.of.links > links.in
>
> or just:
>
>   grep 'https?://[^/]*\.in/' file.of.links > links.in
>
> Only potential oddity would be if you have URLs with non-standard ports
> specified (like "https://foo.in:8080/";); to match that, you could use
> egrep instead (extended regex):
>
>   egrep 'https://[^/]*\.in(:[0-9]+)?/' file.of.links > links.in


One extra change I'd make, to make it more obvious you are checking for a
literal dot and not intending to escape, use [.] instead of \.

So,

egrep 'https://[^/]*[.]in(:[0-9]+)?/' file.of.links > links.in
--
users mailing list
users@lists.fedoraproject.org
To unsubscribe or change subscription options:
https://lists.fedoraproject.org/admin/lists/users@lists.fedoraproject.org
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
Have a question? Ask away: http://ask.fedoraproject.org

Reply via email to