[ILUG] regex newbie question

Andrew McGill glug at lunch.za.net
Sat Aug 9 07:02:39 IST 2008


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