On Thu, Jul 14, 2016 at 04:02:02PM +1000, cs@xxxxxxxxxx wrote: > On 13Jul2016 22:03, Mike Wright <nobody@xxxxxxxxxxxxxxxxxxxx> wrote: > > OK, thanks everybody. > > > > Had to use egrep. This works: > > > > PATTERN='https?://[^/]*\.in(/.*)*' > > egrep $PATTERN file.of.links > links.in > > You need quotes around $PATTERN when you use it, thus: > > egrep "$PATTERN" file.of.links > links.in > ... > > Covers cases with https and where nothing follows the .in > > Your: > > (/.*)* > > is better written: > > (/.*)? > I'll mention one of my pet peeves (kinda like RLS's UUOC* award). In a simple pattern matching grep RE, a repetition operator, '*' (and in egrep '?'), is useless at the start or end of the pattern and may reduce grep's efficiency. grep .*abc grep abc.* grep .*abc.* grep abc Will all match the same set of lines. Note, I'm not referring to some situations where anchors are used (ex. 'abc[0-9]*$'), or sed substitutions, or even grep with the '-o' option to output the matched portion. Jon * Randal L Schwarz' Useless Use Of Cat -- Jon H. LaBadie jonfu@xxxxxxxxxx -- users mailing list users@xxxxxxxxxxxxxxxxxxxxxxx To unsubscribe or change subscription options: https://lists.fedoraproject.org/admin/lists/users@xxxxxxxxxxxxxxxxxxxxxxx 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