473,324 Members | 2,214 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Reading text file with variable field widths

I am using Visual Studio 2005 (VB.Net) to write my app. At some point
the app. need to read a text file with data in columner format. The
problem I have is that the columns are of variable width (not fixed).
Is there a way that I can use white space characters to distinguise
between different fields in a row?

The file is not comma or tab delimited, but it has spaces between
fields. Spaces are present only between individual fields, never in
the fields themselves.

Below is a couple of lines from the file.

1 PH5 902.0 MG 2 T1ORE 1 ORE1 2000 ALL
0.300

1 PH5 902.0 HB% 7 WS101 101 WST1 2000 ALL
0.600

1 PH9 1172.0 FD% 4 WS101 101 WST1 2000 ALL
0.500

Thanks

Nov 8 '06 #1
1 1375
Christie wrote:
I am using Visual Studio 2005 (VB.Net) to write my app. At some point
the app. need to read a text file with data in columner format. The
problem I have is that the columns are of variable width (not fixed).
Is there a way that I can use white space characters to distinguise
between different fields in a row?

The file is not comma or tab delimited, but it has spaces between
fields. Spaces are present only between individual fields, never in
the fields themselves.

Below is a couple of lines from the file.

1 PH5 902.0 MG 2 T1ORE 1 ORE1 2000 ALL
0.300

1 PH5 902.0 HB% 7 WS101 101 WST1 2000 ALL
0.600

1 PH9 1172.0 FD% 4 WS101 101 WST1 2000 ALL
0.500

Thanks
They seem fixed width to me. You just have to decide where the borders
of the fields are.
--
Rinze van Huizen
C-Services Holland b.v
Nov 8 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Chuck Anderson | last post by:
I've read some discussions, searched Google, tried pack, unpack, bin2hex, explode, implode, and I just can't figure out how to convert this data. I am trying to read a file with the following...
6
by: Suresh Kumaran | last post by:
Hi All, Does anybody know the sytax in VB.NET to write the contents of a multiline text box to a text file? Appreciate help. Suresh
1
by: Randell D. | last post by:
HELP! I am determined to stick with this... I'm getting there... for those who haven't read my earlier posts, I'm createing what should be a simple function that I can call to check that...
5
by: Jonathan Daggar | last post by:
Hello, I'm trying to put together a form with a very tight table formatting. However, every time I put an text-type input field in, the browser pads the area to the right of it with space. I've...
7
by: jamait | last post by:
Hi all, I m trying to read in a text file into a datatable... Not sure on how to split up the information though, regex or substrings...? sample: Col1 Col2 ...
7
by: utab | last post by:
Hi there, I am trying to read from a file and at the same time change certain fields of the same field, there are 6 fields in this file like 1 2 3 4 5 6...
2
by: Wes Peters | last post by:
Does anyone know of an article that deals with the subject of reading a structured text file using VBA code in Access? Thanks, Wes
4
waynetheengineer
by: waynetheengineer | last post by:
Hello everyone :) I am trying to write VB code for reading filenames and file property values in a specific directory. For example, I have a directory called C:/Bears and in that directory...
21
by: Stephen.Schoenberger | last post by:
Hello, My C is a bit rusty (.NET programmer normally but need to do this in C) and I need to read in a text file that is setup as a table. The general form of the file is 00000000 USNIST00Z...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.