text drivers for .txt and .csv files ??

Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers text drivers for .txt and .csv files ??
# 1  
Old 03-27-2002
text drivers for .txt and .csv files ??

As a newcomer to UNIX I need to know if there are .txt and .csx ODBC drivers available. I want to import some data and the UNIX tech which I am in contact with does not know much about UNIX!

He asked me to find out if these drivers existed or use a 'LOAD DATA INFILE' command, which is not too familiar to me since my background in databases is windows and Sybase SQL - which Mysql is based on, right?

I don't want to load the data right away, rather check for correct column orders, types, etc and then import at a later time.

UNIX, php and Mysql are very tough to get to work and take a lot of extra time. I could have done this in 2 seconds on a windows box.

Don't get me wrong, I hate anything Microsoft, but at least iHTML (which I use) is a lot better than PHP - no doubt in my mind AND Sybase is much more intuitive than MySQL - so I have to assume that UNIX is a lot more of a pain than Windows.

Any ideas about my import concern?
Pleas email me ::email removed:: since I very rarely go tho this site.


Last edited by oombera; 02-13-2004 at 01:31 PM..
# 2  
Old 03-27-2002
We always hate the things we are unfamilar with Smilie

Anyway, I don't know what your "unix tech" was talking
about with regard to text, ODBC drivers but if you have a "csv"
file, you can load it into MySQL assuming your table
data types are compatable, from the mysql prompt (if
I remember correctly)...

You can enter the file to be loaded with the full path, i.e.
LOAD DATA INFILE "/tmp/file.csv" INTO TABLE newtable;

This is how the text file should be formatted if you use mysql defaults (quoting the manual);
"If you don't specify a FIELDS clause, the defaults are the same as if you had written this:


If you don't specify a LINES clause, the default is the same as if you had written this:


Again, I would recommend becomming familiar with MySQL.
It is NOT based on Sybase. Check out the docs. at...
# 3  
Old 03-28-2002
thanks but..

Thanks for your response, but I wanted to know how to read the .csv file, basically print it to the screen, verify the column orders and data and then do an import at some other time.

This LOAD function is only for importing into the database. I need something similar to Windows where a text/csv ODBC driver has been installed and I use it as my DSN to run my SQL query.

Now a bit of promotion to pass along:

As I become more familiar with PHP and MySQL I am finding the shortcomings in each. iHTML is a much more intuitive and more powerful scripting language. We have it installed on our UNIX server and it is something everyone should consider as an alternative.

The same goes w/ MySQL, which is a junior version of Sybase (as is Microsoft's SQL as well). I'm very concerned what will happen when our database gets very big. Will this sql be as reliable as Sybase? I hope so!

Sure PHP and MySQl are free, but you get what you pay for.

Noodles Smilie
# 4  
Old 03-28-2002
You may want to take a look at unixODBC...

...has lots of certified drivers for different flavors of UNIX.

You may also want to look at MyODBC...

Programs known to work with it are...
Access, Excel and Word among others.

Again, I suggest reading the documentation first.
# 5  
Old 03-29-2002
I may be way off, but you don't need a driver just to read a csv (tsv, *sv) file into data structures.
Use awk, sh, perl.... etc.
For example, each night we produce a very large comma-delimited file each night for importation into a legacy application.
This will check if the file is 120 columns wide. If not, it will identify which row produced the error, and if so, will give us the output of column 52 along with the record identifier, which we can use for reporting purposes:
BEGIN { FS = "," }
   if (NF != 120)
      printf("Bad: %s\n",$1)
      printf("%s %s\n",$1, $52)

If it's OK, it's imported into a legacy database.

And I don't know where you are coming up with the information that MySql is derived from SyBase in any way... That would be like saying that Oracle was built on db2.
Please check your sources, as you may have been misinformed.

Like was said above in another post, we are afraid of (and do not understand the full feature-set of) any product that we are not familiar with. I suggest that if you're really going to use these tool, learn them fully before poo-pooing them.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Search last column of INPUT.txt in TABLEs text and add correspond columns to INPUT.txt

Hi dears i use bash shell i have INPUT.txt like this number of columns different in one some row have 12 , some 11 columns see last column INPUT.txt CodeGender Age Grade Dialect Session Sentence Start End Length Phonemic Phonetic 63 M 27 BS/BA TEHRANI 3 4 298320 310050... (2 Replies)
Discussion started by: alii
2 Replies

2. Shell Programming and Scripting

Read multiple text files and copy data to csv

hi i need to extract lines from multiple files to a csv file. for example, i have these 3 files file1.txt date:29dec1980 caller:91245824255 called:8127766 file2.txt date:11apr2014 caller:9155584558 called:8115478 file3.txt date:25jun2015 caller:445225552 called:8117485 (30 Replies)
Discussion started by: lp.descamps
30 Replies

3. Windows & DOS: Issues & Discussions

2 Questions: replace text in txt file, add text to end of txt file

so... Lets assume I have a text file. The text file contains multiple "#" symbols. I want to replace all thos "#"s with a STRING using DOS/Batch I want to add a certain TEXT to the end of each line. How can I do this WITHOUT aid of sed, grep or anything linux related ? (1 Reply)
Discussion started by: pasc
1 Replies

4. UNIX for Dummies Questions & Answers

How to create a .csv file from 2 different .txt files?

Hi, I need to create a .csv file from information that i have in two different tab delimited .txt file. I just want to select some of the columns of each .txt file and paste them into a .cvs file. My files look like: File 1 transcript_id Seq. Description Seq. Length ... (2 Replies)
Discussion started by: alisrpp
2 Replies

5. UNIX for Dummies Questions & Answers

Need help combining txt files w/ multiple lines into csv single cell - also need data merge

:confused:Hello -- i just joined the forums. I am a complete noob -- only about 1 week into learning how to program anything... and starting with linux. I am working in Linux terminal. I have a folder with a bunch of txt files. Each file has several lines of html code. I want to combine... (2 Replies)
Discussion started by: jetsetter
2 Replies

6. Shell Programming and Scripting

Parsing txt, xml files and preparing csv file

Hi, I need to parse text, xml files to get the statistic numbers and prepare summary csv file. What is the best way to parse these file and prepare csv file. Any idea you have , please? Regards, (2 Replies)
Discussion started by: LinuxLearner
2 Replies

7. Shell Programming and Scripting

Comparing Strings in 2 .csv/txt files?

EDIT: My problems have been solved thanks to the help of bartus11 and pravin27 This code is just to help me learn. It serves no purpose other than that. Here's a sample csv that I'm working with - #listofpeeps.csv Jackie Chan,1954,M Chuck Norris,1930,M Bruce Lee,1940,M This code is... (13 Replies)
Discussion started by: chickeneaterguy
13 Replies

8. Shell Programming and Scripting

Combine Multiple text or csv files column-wise

Hi All I am trying to combine columns from multiple text files into a single file using paste command but the record length being unequal in the different files the data is running over to the closest empty cell on the left. Please see below. What can i do to resolve this ? File 1 File... (15 Replies)
Discussion started by: venky_ibm
15 Replies

9. Shell Programming and Scripting

Sed or awk script to remove text / or perform calculations from large CSV files

I have a large CSV files (e.g. 2 million records) and am hoping to do one of two things. I have been trying to use awk and sed but am a newbie and can't figure out how to get it to work. Any help you could offer would be greatly appreciated - I'm stuck trying to remove the colon and wildcards in... (6 Replies)
Discussion started by: metronomadic
6 Replies

10. Shell Programming and Scripting

AWK CSV to TXT format, TXT file not in a correct column format

HI guys, I have created a script to read 1 column in a csv file and then place it in text file. However, when i checked out the text file, it is not in a column format... Example: CSV file contains name,age aa,11 bb,22 cc,33 After using awk to get first column TXT file... (1 Reply)
Discussion started by: mdap
1 Replies
Login or Register to Ask a Question