[SOLVED] Extract certain data from file, help
Hi, I'm trying to extract the ASCII code and probability from a text file whose lines look like this for example:
31 0 0.000000
32 158380 0.153918
33 72 0.000070
34 1977 0.001921
35 4 0.000004
36 4 0.000004
.. etc. I'm trying to extract just the first and third columns. I'm a little confused as to how do I do this and store them to their appropriate variables. Can I use a tokenizer even though I'm dealing with chars and floats? Thanks in advance!
Prints columns 1 and 3 from a data file
I often use biterscripting ( biterscripting.com for free download ) whenever I don't have time to write code in Java. If this task of printing columns 1 and 3 is a stand-alone task, the following biterscripting code will do the job.
Let's assume the name of the data file is X.
Hope this helps.
var str data ; cat X > $data
while ( $data <> "")
var str line ; lex "1" $data > >$line # Get next line
wex "1" $line # Print the 1st column
wex "3" $line # Print the 3rd column
(Send me email if your requirements are more complex.)