How to get a part of string which follows a particular pattern using shell script

Hari p.r.hariram at gmail.com
Mon May 8 06:18:32 EDT 2006


Hi all,

I need to get a part of string which follows a pattern 'addr='


For example:


a)test="192.168.1.17:/home/ankur/nios_fson/mnt/tmptype
nfs(rw,addr=192.168.1.17)"
b)test="/dev/root on / typr nfs
(rw,v2,rsize=1024,wsize=1024,hard,udp,nolock,addr=192.168.1.93)"


I need to get the ipaddress from the above two strings a and b which
follows 'addr='. I tried to use cut, but it accepts only single charter

as delimiter. If I give delimiter as 'addr=' for cut command it gives
me a error.


So please help me.


A bunch of thanks in advance. 


Regards, 
P.R.Hariram




More information about the Python-list mailing list