Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pull numbers from a terminal

Status
Not open for further replies.

Drake85

Technical User
Nov 18, 2010
4
US
I'm still a bit of a new person when it comes to Aspect (programming is not one of my likes, but I do it because it provides a bit of a challenge).

I'm trying to capture a 5-digit responce from a command sent to an SCO *nix server.

The command I send is:
idump $t/tbspinfo | awk '/natl_store_num/ {printf("%05d",$2)}'

Example output:
22513$

($ is the beginning of the prompt but the prompt is variable)


The responce is a 5 digit number. It's formatted using printf, so I can add in a character return. Problem is I can't figure out how to pull what I want and store it as a string for later use. The string has to be 5 numbers so it can be used inline with other commands.

Any thoughts?

 
Never mind, I figured it out unless someone has a better way to do this.

string testdump
string test
integer testa
proc main
set aspect rgetchar 10
transmit "idump $t/tbspinfo | awk `'/natl_store_num/ {printf(`"%05d\n`",$2)}`'^M"
rget testdump
rget test
atoi test testa
itoa testa test
endproc
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top