List:General Discussion« Previous MessageNext Message »
From:Eric Fitzgerald Date:March 21 2001 10:36pm
Subject:Re: Wildcard in Load Data?
View as plain text  
I'm not 100% familiar with the load data line, I've never had to do it (I
just write import proggies :)

I'd suggest a small little script like this (copy and paste this into a text
file on the server, give it execute permissions, and run it), please excuse
any wrapping:

#!/bin/sh

for file in *.txt; do
    if [ -f $file]; then
        mysql --user=someuser --password=somepassword --execute="LOAD DATA
INFILE '$file' INTO TABLE db.table2 FIELDS TERMINATED BY '\t';
    fi;
done
----- Original Message -----
From: "Marcus Ouimet" <marcus@stripped>
To: <mysql@stripped>
Sent: Wednesday, March 21, 2001 10:42 AM
Subject: Wildcard in Load Data?


> I am trying to load data from several lists. This is what I was trying:
>
> LOAD DATA INFILE '*.*' INTO TABLE table2 FIELDS TERMINATED BY '\t';
>
> For a single file I would have used:
>
> LOAD DATA INFILE 'data.txt' INTO TABLE table2 FIELDS TERMINATED BY '\t';
>
> Any ideas? I have several files that all change names so it would be
easiest
> just to have all the files in the dir loaded.
>
>
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
> To request this thread, e-mail <mysql-thread69090@stripped>
> To unsubscribe, e-mail <mysql-unsubscribe-eric=amntv.com@stripped>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>
>
>

Thread
Wildcard in Load Data?Marcus Ouimet21 Mar
  • Re: Wildcard in Load Data?Eric Fitzgerald21 Mar