Help for string capture
Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Help for string capture
PostPosted: Thu Apr 23, 2009 8:07 am 
Offline
Newbie

Joined: Thu Apr 23, 2009 3:09 am
Posts: 7
Hello All!

I'm a newbie wanting to learn how to use Macro scripting for facilitate my job.
With the help of other posts and the macro scripting command guide i've been able to ease my work a bit
(well my script aren't elegant at all, but they work, and i'm happy;) )
Unfortunately i step on something i can't handle at the moment!
Briefly said 'm working in a lan with aprox 350 routers connected with 2 bgp Link.

Basic aim:

I would like to create a macro that connects to the routers.
Input a commando to show both link status.("sh bgp a s" shows 14 tecnobabbles lines before the 2 i need)
Grab the results and write them into a file.

Optimus:

The resulting file list the name of the router and just the string with the bgp link status.

Actually i'm able to automate router log in, same thing for what concerns command input.
I'm stuck at the point of selecting the information i need and to report them into a file.

If you have spare time would you please point me to a possible solution?
Thank you in advance!

:roll: Alessio


Top
 Profile E-mail  
 
 Post subject: Re: Help for string capture
PostPosted: Thu Apr 23, 2009 2:48 pm 
Offline
Guru

Joined: Wed Jan 25, 2006 7:28 pm
Posts: 532
Location: Denver, Colorado, USA
Use recvln in a loop. For instance:

  1.  
  2. flushrecv                          ;ensure nothing is in the buffer
  3. sendln 'sh bgp a s'
  4. for i 1 14
  5.   recvln                             ;skip past technobabble
  6. next
  7. recvln
  8. filewriteln fh inputstr       ;now save two relevant lines in a file
  9. recvln
  10. filewriteln fh inputstr
  11.  


Top
 Profile  
 
 Post subject: Re: Help for string capture
PostPosted: Mon Apr 27, 2009 2:16 am 
Offline
Newbie

Joined: Thu Apr 23, 2009 3:09 am
Posts: 7
Hello Again!

Ishmael Thank you very much!
It works, perfectly, now i'll just have to arrange things to get the name of the router i'm checking the BGP link from.
When finished i'll post the script in the correct section in case someone would find it useful ;)

ciao!

Alessio


Top
 Profile E-mail  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group