On 2006-10-04 Scott Hamm wrote:
OBJECTIVE:
INPUT:
E524541015.txt:20061004|,535,999|Scot|Hamm|,410|||101 Walter
Rd|Dover|MD|76709|,041|
...
Been trying to get mysqlimport to use these characters to no avail, how do
I get around to it?
I can't answer your question but think that you're following the wrong
approach instead of the simple rule:
Use SQL for storing and calculating and a script language for parsing and
formatting.
It's quite easy with regular expressions (they can be made more readable
with /x):
cat input.txt | perl -n -e
'/^(.{14}):(.{8})\|,(\d+),(\d+)\|[^\|]+\|[^\|]+\|,(\d+)\|.*\|,(\d+)\|$/
print INSERT INTO t VALUES (\$1\,$2,$3,$4,$5,$6);\n;'
The output is ready to be piped into mysql:
INSERT INTO t VALUES (E524541015.txt,20061004,535,999,410,041);
bye,
-christian-
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]