This week's book giveaway is in the Cloud/Virtualizaton forum.We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!

# extract content from table

saurabh sood
Greenhorn
Posts: 17
hi,
i need to extract information(data) from space seprated table that looks as follows:
variable Name Vari Desc. Vari Code
data data data
data data data
this table is embeded in a txt file. please help me out with its logic
thanks

Dirk Schreckmann
Sheriff
Posts: 7023
What have you tried so far?

saurabh sood
Greenhorn
Posts: 17
hi,
i havnt been able to think ogf a logic to do so
saurabh sood

rom chatterjee
Ranch Hand
Posts: 46
You could try holding the table in memory. This could be a vector of vectors. Vector a has a Vector b in each position. Vector a represents the rows (One vector b is one row). Each object in vecotr b is an entry of column data.
Read the file a line at a time. One line is one row. When you have a line, parse it into n Strings looking for whitespace. Put each string into a vector b. When there are no more entries, place vector b in vector a and move onto the next line (row).
You dont have to use vectors, you could use an array of arrays table[][], where table [0][1] is the value in the second column of the first row.
Conceptually tih is a bit like...
row1[ [col1] [col2] [col3] ]
row2[ [col1] [col2] [col3] ]
Hope this helps