PHP Classes

Read tab delimited text file and sort by columns: Need to sort by columun a tab delimited text file

Recommend this page to a friend!
  All requests RSS feed  >  Read tab delimited text file and sort...  >  Request new recommendation  >  A request is featured when there is no good recommended package on the site when it is posted. Featured requests  >  No recommendations No recommendations  

Read tab delimited text file and sort by columns

Edit

Picture of Michael Wassil by Michael Wassil - 6 years ago (2015-02-10)

Need to sort by columun a tab delimited text file

This request is clear and relevant.
This request is not clear or is not relevant.

0

I need to read a tab delimited text file, display it as a table sorted by columns

Ask clarification

1 Recommendation

MySQL Database Library: Access MySQL databases and manipulate files

This recommendation solves the problem.
This recommendation does not solve the problem.

+1

Picture of Justin Eldracher by Justin Eldracher package author package author Reputation 140 - 6 years ago (2015-06-22) Comment

The read() method in my class will read a tab/comma delimited file into a matrix, doesn't have a built in sorting feature, though. The method defaults to csv, but if you change the $_csvdelim_ variable, or include the customer delimiter as the third parameter, you can read any type of delimited file. So for example, you would need these three lines:

include "DB.php"; $db = new DB(); print_r($db->read("delimited.txt", "csv", "\t"));

The second parameter must be "csv" so the method knows it's dealing with delimited text.

Hope that helps.


Recommend package
: 
: 
For more information send a message to info at phpclasses dot org.