Searching a string in a line

Hi
I would be really greatfull if any one can give me some lights on my
bellow query .

I want to run a query like this

subject= system" ldapsearch -xZZ -D cn=Directory Managerl -w 'testtest'
-b 'ou=groups,l=uk,dc=fosiul,dc=lan' cn=ops-uk"

now it should return a output like this

# extended LDIF

···

#
# LDAPv3
# base <ou=groups,l=uk,dc=fosiul,dc=lan> with scope subtree
# filter: cn=techops-uk
# requesting: ALL
#

# techops-uk, groups, UK, fosiul.lan
dn: cn=ops-uk,ou=groups,l=UK,dc=fosiul,dc=lan
gidNumber: 6000
objectClass: top
objectClass: groupofuniquenames
objectClass: posixgroup

cn: hops-uk

# search result
search: 3
result: 0 Success

# numResponses: 2
# numEntries: 1

Now i just need to grab this line

gidNumber: 6000 to get just 6000

actually 6000

but dont understand.. how to do that
Can any one please help me with this

Thanks for your help.
Fosiul

--
Posted via http://www.ruby-forum.com/.

Hi,

Use a regular expression:

p subject[/^gidNumber: (\d+)/, 1]

···

--
Posted via http://www.ruby-forum.com/.

Hi
thanks thats great .

···

--
Posted via http://www.ruby-forum.com/.