In python ----------------------------- import re file = open("path/to/file","r")
for line in file: line = line.replace("\n","")# this is not always needed columns = re.split("\s+",line) print columns#is now a list print columns[0] sql = "insert into ..." ----------------------------- If the file is large use for line in fileinput.input("path/to/file"): instead Olaf On 7/6/07 12:04 PM, "Scott Swaim" <[EMAIL PROTECTED]> wrote: > I have a text file that is in the Panasonic DBS format. It is a log file > that comes from my phone system. I have a program that monitors the serial > port and write the input to a file. I have no control over the format of > the file. I would like to on a nightly basis shut down the logging program > and then upload this file to Mysql. What I don't know how to do is to have > the file split into the correct fields. > > > Here is a sample of the file > > > MO 07/03 13:58:00 00:00:34 103 18172959782 04 > MO 07/03 13:58:00 00:00:24 103 8175177982 05 > MO 07/03 13:59:00 00:00:23 103 8175177982 04 > MO 07/03 13:53:00 00:07:25 105 180044454450000000 06 > MI 07/03 14:00:00 00:01:55 100 8177740741 01 > > > > It is a fixed format so I could probably just write a script that parses the > program > Or write a script that adds a comma to the correct location. > > Does anyone have any suggestions or already have something that does this? > > > Thanks in Advanced > Scott Swaim > > -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]