Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > Scripting

Notices

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 08-01-2018, 10:22 PM
cekoj cekoj is offline
Registered User
 
Join Date: Jul 2018
Posts: 3
Post Get specific values from a table

Support me with some problem that i have. We are performed an audit logs but, is there a form to get some specific values in a table?

We have detected 2 different tables as below:
Code:
TABLE 1:
====================================================================================================================================
FRU    LNH    BOARD       ST FAULT OPER MAINT STAT PRODUCTNUMBER   REV     SERIAL        DATE      TEMP
=====================================================================================================================================
BB-1   000100 DUS5301      1   OFF   ON   OFF   ON KDU137848/11    R2B     B441317340    20180407        (Bb6630)
Code:
TABLE 2:
SMN APN  BOARD    FAULT  OPER   MAINT  STAT    PRODUCTNUMBER  REV    SERIAL     DATE     TEMP COREMGR
====================================================================================================================
  0   1  DUW4101  OFF    ON     OFF    OFF     KDU127174/4    R2F    TU8XAW5590 20160726 68C  Active*
--------------------------------------------------------------------------------------------------------------------
The problem is that I want to get PRODUCTNUMBER, REV, SERIAL and DATE. As you see, values are not separate with a constant spaces.

Please, if you can give me an advice or support, provide your feedback.

Last edited by jdev; 08-06-2018 at 10:20 AM.
Reply With Quote
  #2  
Old 08-02-2018, 07:47 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,636
Hi cekoj,

What version of SecureCRT are you using?

On what OS/platform?

Please review the scripting manual here.

In Chapter 4, it contains info on Reading Data from Remote Machines.
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #3  
Old 08-06-2018, 10:04 AM
cekoj cekoj is offline
Registered User
 
Join Date: Jul 2018
Posts: 3
This is Version 7.0.4 (x64 build 537)

Actually i tried using the manual but i'm still with problems because only i got one value and the others are not working. I'd like to know how you structure your scripts for this kind of request
Reply With Quote
  #4  
Old 08-06-2018, 11:29 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,636
Hi cekoj,

That's a really old version of SecureCRT.

Please elaborate on what you mean by "only got one value".

Since there is an inconsistent amount of spaces *separating* the data you wish to get, you will have to look for other ways to isolate what you need.

Is there a consistent number of characters (and spaces) for all four fields taken together? (In other words, could you get 50 characters in the line each time and then split it on the spaces and trim the results?)

If not, is there a pattern to each field so you can isolate each one? (Is there always a "/" in Product Number? Is "R2" always found in Rev? Is the Serial a consistent number of alphanumeric characters? Is the Date consistently YYYYMMDD?)
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #5  
Old 08-14-2018, 11:43 AM
bstedh bstedh is offline
Registered User
 
Join Date: Jan 2018
Posts: 41
Remove all the excess spaces and then split by space to put each item in an array.

Start by reading the line into a variable.
Code:
input = crt.Screen.Readstring (vbCr)
Remove excess spaces

Code:
Do While InStr(1,input,"  ") 'loop while there are more than just single spaces
    input = Replace(input,"  "," ") 'replaces double spaces with a single space
Loop
Split the input into an array that contains each item in the line.

Code:
arroutput = Split (input," ") 'splits the info using a space as a delimiter
Now the array arroutput contains each item separately to use as you would like.
__________________
Version 6.7.3 (build 292)
Reply With Quote
  #6  
Old 08-29-2018, 10:35 PM
cekoj cekoj is offline
Registered User
 
Join Date: Jul 2018
Posts: 3
Thanks for your analysis. I got to add in my script in order to read all sites and configure properly.
Reply With Quote
Reply

Tags
columns , script , table

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 09:41 AM.