This is the third problem today which I propose to solve with my stream editor SE. If the group thinks it could be useful I would submit it the moment I'm done with the doc, which is in the final stage.
Frederic >>> se = SE.SE ('<EAT> ~addr=[0-9.]+~==(10) | addr\== ') >>> string = """(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)")""") >>> print se (string) 192.168.1.17 192.168.1.93 ----- Original Message ----- From: "Hari" <[EMAIL PROTECTED]> Newsgroups: comp.lang.python To: <python-list@python.org> Sent: Monday, May 08, 2006 12:18 PM Subject: How to get a part of string which follows a particular pattern usingshell script > 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 > > -- > http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list