Jump to content

Recommended Posts

Posted (edited)

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
Posted

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 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted (edited)

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.

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
×
×
  • Create New...