Re: How to extract certain part of an regexp?

Re: How to extract certain part of an regexp?

am 20.12.2007 12:47:34 von mik3l3374

On Dec 17, 4:40 pm, byang wrote:
> Hi,
> I know I can "grep -o " to find the whole regexp pattern, but how
> can I extract the part of the regexp pattern? For example:
> There is a string:
>
> The report number id is <12345> and index is 23;
>
> I want to extract the number 12345 only. Thank you very much!
>
> Regards!
> Bo

in bash

# s="The report number id is <12345> and index is 23;"
# IFS="<>"
# set -- $s
# echo $2