Re: OT: grep and regex patterns

2016-07-15 Thread Jon LaBadie
On Thu, Jul 14, 2016 at 04:02:02PM +1000, c...@zip.com.au wrote: > On 13Jul2016 22:03, Mike Wright 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 wh

[SOLVED] Re: OT: grep and regex patterns

2016-07-14 Thread Mike Wright
On 07/13/2016 11:02 PM, c...@zip.com.au wrote: On 13Jul2016 22:03, Mike Wright 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 "$PATT

Re: OT: grep and regex patterns

2016-07-13 Thread cs
On 13Jul2016 22:03, Mike Wright 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 You may be getting away wi

Re: OT: grep and regex patterns

2016-07-13 Thread Mike Wright
On 07/13/2016 08:46 PM, Chris Adams wrote: Once upon a time, Jon LaBadie said: On Thu, Jul 14, 2016 at 02:09:27AM +, Christopher wrote: On Wed, Jul 13, 2016, 21:11 Chris Adams wrote: Once upon a time, Mike Wright said: Putting all that together, I'd recommend: PATTERN='https?://[^

Re: OT: grep and regex patterns

2016-07-13 Thread Chris Adams
Once upon a time, Jon LaBadie said: > On Thu, Jul 14, 2016 at 02:09:27AM +, Christopher wrote: > > On Wed, Jul 13, 2016, 21:11 Chris Adams wrote: > > > > > Once upon a time, Mike Wright said: > > > > > > Putting all that together, I'd recommend: > > > > > > PATTERN='https?://[^/]*\.in/' >

Re: OT: grep and regex patterns

2016-07-13 Thread Jon LaBadie
On Thu, Jul 14, 2016 at 02:09:27AM +, Christopher wrote: > On Wed, Jul 13, 2016, 21:11 Chris Adams wrote: > > > Once upon a time, Mike Wright said: > > > > Putting all that together, I'd recommend: > > > > PATTERN='https?://[^/]*\.in/' > > grep "$PATTERN" file.of.links > links.in Minor

Re: OT: grep and regex patterns

2016-07-13 Thread Christopher
On Wed, Jul 13, 2016, 21:11 Chris Adams wrote: > Once upon a time, Mike Wright 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 pote

Re: OT: grep and regex patterns

2016-07-13 Thread Chris Adams
Once upon a time, Mike Wright said: > PATTERN="^.*http:\/\/.*\.in.*$" > grep $PATTERN < file.of.links >links.in Several issues I see: - it appears you are using a shell variable to pass the pattern; since you are using double quotes, shell interpolation occurs, so all the escaping \ characte

OT: grep and regex patterns

2016-07-13 Thread Mike Wright
Hi all, There is a file with a collection of links from global sites. While trying to sort the links into categories I'm catching the wrong things. e.g. find links from India: PATTERN="^.*http:\/\/.*\.in.*$" grep $PATTERN < file.of.links >links.in Even though the "." in front of "in" is esc