We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,459 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

How to extract columns/rows of values from a text file?

I have a text file in this format:

AUGC
U1212
A2121
G3434
C4343

I need to extract the number that I need depending on which variables (letters) I'm comparing. For example, I need the value for A and U, so the value I need to look up for or extract is 1. For C and C, I will need to extract 3, and so on and so forth. I need a program that can look up this table automatically and extract what I need. May I know how do I do that?

2
Contributors
2
Replies
9 Hours
Discussion Span
2 Years Ago
Last Updated
3
Views
Question
Answered
Sunshineserene
Junior Poster
187 posts since Jul 2010
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

Sorry, the first row, AUGC should be directly above the numbers 1212. There is some posting error. So the top right hand corner is actually a blank.

Sunshineserene
Junior Poster
187 posts since Jul 2010
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

Say a row = a line and a column a word on that line.
Create a 2 dim array with first dim >= number of lines in file
Read in file and parse words of each line into an array and add that array to the first array at its line number.
Now you can get the contents of each row and column by indexing the 2 dim array.

NormR1
Posting Sage
Team Colleague
7,742 posts since Jun 2010
Reputation Points: 1,158
Solved Threads: 793
Skill Endorsements: 16
Question Answered as of 2 Years Ago by NormR1

This question has already been solved: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.0643 seconds using 2.66MB