[ILUG] regex newbie question

Hanafin, Jenny jenny.hanafin at nuigalway.ie
Mon Aug 11 09:57:56 IST 2008


Hi Andrew,

thank you so much for pointing that out, the output from ls was the problem, not the grepping after all.

Jenny


-----Original Message-----
From: Andrew McGill [mailto:glug at lunch.za.net]
Sent: Sat 09/08/2008 07:02
To: ilug at linux.ie
Cc: Hanafin, Jenny; Padraig Kitterick
Subject: Re: [ILUG] regex newbie question
 
On Friday 08 August 2008 18:25:06 Hanafin, Jenny wrote:
> I've tried that egrep expression and egrep hung, so I put quotes around it
> and it worked, but returned no matches. I'm not finding that egrep is any
> more consistent than grep, though, this is a result I got from playing
> around a bit with your suggested expression:
>
> [219]: ls /data/gps/TEMP | egrep '^[[:alpha:]]{4}[0-9]{3}[a-x]'
> MACE213h.08n  MACE213h.08o  mace.lst      VLNT160z.08n  VLNT160z.08o
> VLNT213l.08n  VLNT213l.08o  VLNT.apr      vlnt.lst
>
> so egrep is still returning 'vlnt.lst' which contains no digits. 
It looks as if you have an alias for ls, alias ls="ls -C".  Have a look at the 
output of 
	ls /data/gps/TEMP | egrep --color '^[[:alpha:]]{4}[0-9]{3}[a-x]'
That will highlight the matching part for you.

&:-)



More information about the ILUG mailing list