Analyzing contents of a text file, manipulating it, and writing manipulated data
Analyzing contents of a text file, manipulating it, and writing manipulated data
Analyzing contents of a text file, manipulating it, and writing manipulated data
Analyzing contents of a text file, manipulating it, and writing manipulated data
Analyzing contents of a text file, manipulating it, and writing manipulated data
Analyzing contents of a text file, manipulating it, and writing manipulated data Analyzing contents of a text file, manipulating it, and writing manipulated data Analyzing contents of a text file, manipulating it, and writing manipulated data Analyzing contents of a text file, manipulating it, and writing manipulated data Analyzing contents of a text file, manipulating it, and writing manipulated data Analyzing contents of a text file, manipulating it, and writing manipulated data Analyzing contents of a text file, manipulating it, and writing manipulated data Analyzing contents of a text file, manipulating it, and writing manipulated data
Analyzing contents of a text file, manipulating it, and writing manipulated data Analyzing contents of a text file, manipulating it, and writing manipulated data
Analyzing contents of a text file, manipulating it, and writing manipulated data
Go Back  Xtreme Visual Basic Talk > > > Analyzing contents of a text file, manipulating it, and writing manipulated data


Reply
 
Thread Tools Display Modes
  #1  
Old 07-25-2009, 02:57 PM
KarmaRules KarmaRules is offline
Newcomer
 
Join Date: Jul 2009
Location: Berkshire
Posts: 4
Question Analyzing contents of a text file, manipulating it, and writing manipulated data


PLEASE HELP.

Am very new to this software and might be asking a very simple question, but please help.

am basically reading a text file with info like this:

"S1($=""ChW System Pressure"",V=134.00,%=""Pa""),S2($=""UPS_Batt Rm 1to4 Circ A Flow "",V=9.17,%=""DegC""),S3($=""UPS_Battery Rm Sec ChW Rtn"",V=-38.38,%=""DegC""),S4($=""Buffer Vessel BV-02 High Temp"",V=9.08,%=""DegC""),...

and i'm trying to write a program that read the data, filters the sections so that per line it does the bit before the brackets i.e. "S1" then a comma then the sections inside the brackets as comma seperated values removing the double quotes and symbols i don't want etc.
Basically dividing the seperate S*'s onto different lines and seperating teh values with comma's.
There are also other points whcih are a different letter than "'S" and the same to do with them to.

Can ayone help please and get me started

Thanks

Last edited by KarmaRules; 07-25-2009 at 06:24 PM. Reason: more info, highlighting the fact i'm after tips, not it being written for me!!
Reply With Quote
  #2  
Old 07-25-2009, 04:14 PM
KarmaRules KarmaRules is offline
Newcomer
 
Join Date: Jul 2009
Location: Berkshire
Posts: 4
Default

more info:

I basically want to write a program that takes:

"S1($=""ChW System Pressure"",V=134.00,%=""Pa""),S2($=""UPS_Batt Rm 1to4 Circ A Flow "",V=9.17,%=""DegC""),S3($=""UPS_Battery Rm Sec ChW Rtn"",V=-38.38,%=""DegC""),S4($=""Buffer Vessel BV-02 High Temp"",V=9.08,%=""DegC""),...

and makes:

S1,ChW System Pressure,134.00Pa
S2,UPS_Batt Rm 1to4 Circ A Flow ,9.17,DegC,
S3,UPS_Battery Rm Sec ChW Rtn,-38.38,DegC
S4,Buffer Vessel BV-02 High Temp,9.08,DegC
...and carry on through file.


PLEASE HELP (i'm not asking for it to be handed to me, but the functions I might want to look into using etc would be nice)

Last edited by KarmaRules; 07-25-2009 at 06:23 PM. Reason: to highlight me ASKING for info on writing it myself!
Reply With Quote
  #3  
Old 07-25-2009, 05:56 PM
AtmaWeapon's Avatar
AtmaWeaponAnalyzing contents of a text file, manipulating it, and writing manipulated data AtmaWeapon is offline
Fabulous Florist

Forum Leader
* Guru *
 
Join Date: Feb 2004
Location: Austin, TX
Posts: 9,500
Default

There's not a magic solution I can give to you; most of the effort in programming comes from solving problems that aren't solved by something else.

Right now your question looks like "Would someone write this for me?" and the answer is "No." This is a forum for teaching and learning, and the only lesson you'd learn is that people will do your work for free. If you could ask a specific question, someone could help. In fact, if you ask the right questions the answers will basically write the question for you, but you have to ask them one at a time.
__________________
.NET Resources
My FAQ threads | Tutor's Corner | Code Library
I would bet money 2/3 of .NET questions are already answered in one of these three places.
Reply With Quote
  #4  
Old 07-25-2009, 06:09 PM
KarmaRules KarmaRules is offline
Newcomer
 
Join Date: Jul 2009
Location: Berkshire
Posts: 4
Unhappy

Apologies if my thread came across as wanting someone to write it for me, the writing is the fun for me and would not want to just have it prepackaged.

I was merely asking for a pointer in the right direction for the method as I am unsure which functions would be the ones to use.

I understand that if I take the text file and create a new line when there is a closing bracket (parenthesis') and then filter out certain characters then it may be enough but i'm not sure what commands and functions etc to use.

I have completed the simple bit of the form with two multiline text boxes, a button that imports the raw text file into the first and the filesave from the second textbox with menu system etc.

I am now in need of the middle step, the transposing of the raw data from textbox1 to textbox2 while carrying out the changes and have been trying to find the correct function(s) for this

Please can anyone help as i'm new to this package and any help would be grateful.

Best Regards
Reply With Quote
  #5  
Old 07-25-2009, 08:40 PM
Roger_Wgnr's Avatar
Roger_Wgnr Roger_Wgnr is offline
CodeASaurus Hex

Forum Leader
* Expert *
 
Join Date: Jul 2006
Location: San Antonio TX
Posts: 2,427
Default

Well, I will give you where I would start with this problem and a bit of direction.
First read the entire file into a string variable.
Then split the string into an array using the String.Split function
then parse each line of the array to create the desired output (note that with the exception of element 0 each element sill have a starting comma)
Then write the resulting lines to a file.

To parse the data I would use the following methods
InString
IndexOf

Hope this gets you started. If you have more specific questions post back and We will be glad to help.
__________________
Code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. ~Martin Golding
The user is a peripheral that types when you issue a read request. ~Peter Williams
MSDN Visual Basic .NET General FAQ
Reply With Quote
  #6  
Old 07-26-2009, 04:40 AM
KarmaRules KarmaRules is offline
Newcomer
 
Join Date: Jul 2009
Location: Berkshire
Posts: 4
Thumbs up Thank You

Quote:
Originally Posted by Roger_Wgnr View Post
Well, I will give you where I would start with this problem and a bit of direction.
First read the entire file into a string variable.
Then split the string into an array using the String.Split function
then parse each line of the array to create the desired output (note that with the exception of element 0 each element sill have a starting comma)
Then write the resulting lines to a file.

To parse the data I would use the following methods
InString
IndexOf

Hope this gets you started. If you have more specific questions post back and We will be glad to help.
You're a star, i'll get right on it, thank you so much
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Analyzing contents of a text file, manipulating it, and writing manipulated data
Analyzing contents of a text file, manipulating it, and writing manipulated data
Analyzing contents of a text file, manipulating it, and writing manipulated data Analyzing contents of a text file, manipulating it, and writing manipulated data
Analyzing contents of a text file, manipulating it, and writing manipulated data
Analyzing contents of a text file, manipulating it, and writing manipulated data
Analyzing contents of a text file, manipulating it, and writing manipulated data Analyzing contents of a text file, manipulating it, and writing manipulated data Analyzing contents of a text file, manipulating it, and writing manipulated data Analyzing contents of a text file, manipulating it, and writing manipulated data Analyzing contents of a text file, manipulating it, and writing manipulated data Analyzing contents of a text file, manipulating it, and writing manipulated data Analyzing contents of a text file, manipulating it, and writing manipulated data
Analyzing contents of a text file, manipulating it, and writing manipulated data
Analyzing contents of a text file, manipulating it, and writing manipulated data
 
Analyzing contents of a text file, manipulating it, and writing manipulated data
Analyzing contents of a text file, manipulating it, and writing manipulated data
 
-->