I have a huge file with millions of columns, splited by space, but it only has a limited number of rows:
examples.txt:
1 2 3 4 5 ........
3 1 2 3 5 .........
l 6 3 2 2 ........
Now, I just want to read in the second column:
2
1
6
How do I do that in java with high performance.
Thanks
Update: the file is usually 1.4G containing hundreds of rows.
ALT + Left Mouse Click puts you in Column Mode Select. It's quite an useful shortcut that may help you. This is by far the simplest solution.
Make a list of columns that have to be extracted. Use read_csv() method to extract the csv file into data frame. Print the exracted data. Plot the data frame using plot() method.
If your file is not statically structured, your only option is the naive one: read through the file byte sequence by byte sequence looking for newlines and grab the second column after each one. Use FileReader
.
If your file were statically structured, you could calculate where in the file the second column would be for a given line and seek()
to it directly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With