Jump to content
Sign in to follow this  
DORA

simple help please

Recommended Posts

DORA

hi all

i am trying to extract the string after a specific word (Node Type ) in a txt file !!

txt file look like

Windows IP Configuration

   Host Name . . . . . . . . . . . . : LINEZERO-PC
   Primary Dns Suffix  . . . . . . . : 
   Node Type . . . . . . . . . . . . : Hybrid
   IP Routing Enabled. . . . . . . . : No
   WINS Proxy Enabled. . . . . . . . : No
   DNS Suffix Search List. . . . . . : afaqe2e.com

how can i do it ?? i tryied for 3 hours and i could not make it

sorry for my bad english Posted Image

Edited by DORA

Share this post


Link to post
Share on other sites
water

Something like:

$aString = StringSplit("Node Type . . . . . . . . . . . . : Hybrid",":")
If $aString[1] = "Node Type . . . . . . . . . . . . " Then ConsoleWrite("Node Type = " & StringStripWS($aString[2],3) & @CRLF)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
somdcomputerguy

Well that's almost just what I came up with.. yay me! :(:mellow:

$file = FileOpen("dorahelp.txt", 0)
While 1
    $line = FileReadLine($file)
    If @error = -1 Then ExitLoop
    $result = StringInStr($line, "Node Type")
    If $result <> 0 Then
    $text =  StringSplit($line, ":")
    $text1 = StringStripWS($text[2], 1)
    ConsoleWrite($text1 & @LF)
    EndIf
Wend
FileClose($file)

Except for the StringStripWS line..

Edited by snowmaker

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.