• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 262
  • Last Modified:

How to parse out information in a text file

How can I read any file with the extension .zpl file extenstion and also how can i parse out data?
I need to parse the data out like the file attached.
Dim FILE_NAME As String = "C:\gftest.zpl"
        Dim data As String
        Dim objReader As New System.IO.StreamReader(FILE_NAME)

Open in new window

gftest1.txt
0
cmdolcet
Asked:
cmdolcet
  • 3
  • 3
1 Solution
 
Brad HoweDevOps ManagerCommented:
What is the format of the gftest.zpl?

There are many ways to read in a file but you don't seem to have a writer yet.

Please provide example input and output and i'm sure someone will be able to assist.

Cheers,
Hades666
0
 
cmdolcetAuthor Commented:
the format of the .zpl is a text file (.txt)
0
 
CodeCruiserCommented:
Here is how to read a text file

Dim TextInFile As String = IO.File.ReadAllText("C:\gftest.zpl")




What is the format of the data mate? Show us some sample zpl file.

0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
cmdolcetAuthor Commented:
the data file is attached
gftest1.txt
0
 
CodeCruiserCommented:
What does this file contain? Is it some useful information? Did you try the above method?
0
 
cmdolcetAuthor Commented:
Yes i did try it. I need the file to be divided when ever you see a ^ so could i do a split? Right now everything is coming over in one variable I want to break it up and send data to other variables.
0
 
CodeCruiserCommented:
Yes you can use the split function

Dim FileContents As String = IO.File.ReadAllText("path")

For Each Portion As String in FileContents.Split("^")
     ProcessPortion(portion)
Next
0

Featured Post

[Webinar] Kill tickets & tabs using PowerShell

Are you tired of cycling through the same browser tabs everyday to close the same repetitive tickets? In this webinar JumpCloud will show how you can leverage RESTful APIs to build your own PowerShell modules to kill tickets & tabs using the PowerShell command Invoke-RestMethod.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now