473,804 Members | 3,453 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

read specific line in text file

92 New Member
Hi
I have a text file that has differnt information

to be more clear i hav eto say that i have three differnt kind of information.
the column name for all the information are same but there is number at the top that i can undestand whenere shall it go.
it looks like some thing like this

102
(There are some lines here that i do not need it)
A B C
aaa 2 3 5
bbb 1 4 6
ccc 3 1 5

103
(There are some lines here that i do not need it)
A B C
aaa 3 3 7
bbb 1 2 1
ccc 4 1 4

104
(There are some lines here that i do not need it)
A B C
aaa 4 1 5
bbb 3 1 1
ccc 2 3 7


their position in text file are all same.

thanks alot

P.S:(TO Killer): I solved that problems for IBM Terminal.
I did half of the job in marco in the Application and then half with access
i did a macro that will copy and select and append all the pages in my application and the paste it in a text file in access.
Dec 6 '07 #1
7 8087
debasisdas
8,127 Recognized Expert Expert
If you completely solved that ,then why you posted it here ?
Dec 6 '07 #2
voroojak
92 New Member
this is another problem. now i have problem with this text file. i said that i soved the problem with the IBM Terminal not textfile.
now i dont kno whow can i skip those lines that i do not need.

i would appreciate any help
Dec 6 '07 #3
voroojak
92 New Member
maybe i have to explain more

in my textfile i hav e3 differnt information that according to the information it has to go and sit in differnt table.

as i said the coulmn name is same for all and the position.
just if at the top it is 102 then it is for table 103 and 103 for 103 and .....

i dont know how can i read the lines i want. and skip the lines that i do not want.

thanks
Dec 6 '07 #4
bxscikid
2 New Member
You need to add the items in your textfile into an array. Once the array is filled, you can call a specific part of the array using
Expand|Select|Wrap|Line Numbers
  1. Myarray(indexnumber)
Dec 9 '07 #5
Killer42
8,435 Recognized Expert Expert
You need to add the items in your textfile into an array. Once the array is filled, you can call a specific part of the array using
Expand|Select|Wrap|Line Numbers
  1. Myarray(indexnumber)
Surely if you only want particular lines form the file, you would simply read the file line by line and only process the ones you want. Like...

Expand|Select|Wrap|Line Numbers
  1. Open File
  2. Do Until EOF
  3.   Read line from file
  4.   If line matches what I want ("102" or whatever) Then
  5.     Process this line
  6.   End If
  7. Loop
Dec 10 '07 #6
voroojak
92 New Member
Hi
thanks for the solution.
Dec 10 '07 #7
Killer42
8,435 Recognized Expert Expert
thanks for the solution.
Glad we could help. :)
Dec 12 '07 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

6
30988
by: sea | last post by:
I have text files in the following format: 123,34, ,345,890, 123,23 .. .. .. As you can see, the problem is that (1) the commas can occur in
0
1570
by: Majordomo | last post by:
-- >>>> --36742377 **** Command '--36742377' not recognized. >>>> Content-Type: text/plain; charset=us-ascii **** Command 'content-type:' not recognized. >>>> Content-Transfer-Encoding: 7bit **** Command 'content-transfer-encoding:' not recognized. >>>> >>>> something is fool
1
4312
by: Magix | last post by:
Hi, I have these string data: str_data1, str_data2, str_data3, which capture some value after a routine process A. Then I would like to write (append) these 3 string values into a text file each time after routine process A, the text file is named "mytext.dat" in following format with "#####" as separator. The maximum entries of them is 5. When reaching the fifth entry, it will delete the very first entry.
3
5226
by: JenHu | last post by:
Hi, I want read line by line and characters. The characters are fix length text file, no specific delimited method between each fields. The first line is header line, the last line is footer. Between the first line and last line is the content, and I will have to load the content to database. How to read line by line? I use For lineNum = LBound(lines) To (UBound(lines) - 1) which generate error because it does read the
2
5520
by: RyanS09 | last post by:
Hi- I have read many posts with specific applications of reading in text files into arrays, however I have not been able to successfully modify any for my application. I want to take a text file filled with a tab delimited list of 10 columns (floats) and read it into a 2D array. The length of the columns are all the same, however this will be variable from text file to text file. Any help (starter code or where to read) would be much...
9
3015
by: =?Utf-8?B?QnJpYW4gQ29vaw==?= | last post by:
I want to open a text file and format it into a specific line and then apply color to a specific location of the text and then display it in a RichTextBox after all of this is done. I can do all of the above after the file is loaded into the RichTextBox, and I am trying to speed the process up by doing it in a temp file.
0
1413
by: Snoze | last post by:
Hello, I'm trying to make an application with C# that writes and reads some lines of a text file, but I want to read one specific line and save the text in a string variable. And the inverse process, save a string variable in a specific line of the text file. Also i think that it could be done writing in the textfile "first= Here the text of the first line", "second= here the text of the second line"... and then, my application when want to...
6
418
by: rohit | last post by:
Hi All, I am new to C language.I want to read integers from a text file and want to do some operation in the main program.To be more specific I need to multiply each of these integers with another set of integers stored in an array.It would be a great help if you could provide some code for it.I tried the function fscanf but by that I am able to read only the first integer of the text file.Please help me.
5
1653
by: CSharp-Jay | last post by:
So I have been programming in C# on a personal level as of lately, and am curious about something. Lately I have been experimenting around with file create/write, etc. I can open and read the whole file, but how do I read specific words into my program? Like for example, I have an ini file that my program writes to and needs to read from to know user specific settings. But I need to know each line individually and what the value is so...
4
3420
by: Keith G Hicks | last post by:
I'm trying to read a text file and alter the contents of specific lines in the file. I know how to use streamreader to read each line of a file. I'm doing that already to get the data into a database. What I need help with is on how to locate a specific line in the file, change it and then save the updated text file. Can anyone help me out or point me to a site that explains this clearly? Here's part of my code that reads the contents of...
0
9705
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9576
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10567
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10323
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10310
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9138
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5515
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5647
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2983
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.