egrep pattern match problem

egrep pattern match problem

am 17.09.2007 20:32:11 von peter sands

Hi,

I am trying to extract codes from a file, that only have 4 numbers
after the 'EDT.'

example file:
EDT.1299
EDT.53992
EDT.34013
EDT.solide


When using the following , it will exclude any non-chars , but returns
all the rest of EDT.* matches ie: any numbers followed after EDT.
When I only want EDT. plus 4 numbers


$ egrep 'EDT.[0-9]{4}' resp.txt
EDT.1299
EDT.53992
EDT.34013

This is running on aix. Any pointers please.
Thanks
Pete

Re: egrep pattern match problem

am 17.09.2007 20:58:39 von Cyrus Kriticos

peter sands wrote:
>
> I am trying to extract codes from a file, that only have 4 numbers
> after the 'EDT.'
>
> example file:
> EDT.1299
> EDT.53992
> EDT.34013
> EDT.solide
>
>
> When using the following , it will exclude any non-chars , but returns
> all the rest of EDT.* matches ie: any numbers followed after EDT.
> When I only want EDT. plus 4 numbers
>
> $ egrep 'EDT.[0-9]{4}' resp.txt
>
> This is running on aix. Any pointers please.

egrep 'EDT.[0-9]{4}$' resp.txt

--
Best regards | "The only way to really learn scripting is to write
Cyrus | scripts." -- Advanced Bash-Scripting Guide

Re: egrep pattern match problem

am 17.09.2007 21:28:33 von peter sands

>
> egrep 'EDT.[0-9]{4}$' resp.txt
>
> --
> Best regards | "The only way to really learn scripting is to write
> Cyrus | scripts." -- Advanced Bash-Scripting Guide


Thanks, that works
Pete

Re: egrep pattern match problem

am 18.09.2007 14:43:37 von Stephane CHAZELAS

2007-09-17, 11:32(-07), peter sands:
> I am trying to extract codes from a file, that only have 4 numbers
> after the 'EDT.'
>
> example file:
> EDT.1299
> EDT.53992
> EDT.34013
> EDT.solide
>
>
> When using the following , it will exclude any non-chars , but returns
> all the rest of EDT.* matches ie: any numbers followed after EDT.
> When I only want EDT. plus 4 numbers
>
>
> $ egrep 'EDT.[0-9]{4}' resp.txt
> EDT.1299
> EDT.53992
> EDT.34013
[...]

grep -Ex 'EDT.[0-9]{4}' resp.txt

--
Stéphane