Hi Paul,
assuming that the first three occurances of blanks can be regarded as
field separators you can do:
prompt> cat file.txt | sed \
-e "s/'/\\\\'/g" \
-e "s/ */','/" \
-e "s/ */','/" \
-e "s/ */','/" \
-e "s/^/INSERT INTO categories VALUES('/" \
-e "s/$/');/" | mysql database
That's what sed is good for.
Regards,
Thomas Spahni
On Thu, 27 May 2004, Haplo wrote:
> Hi,
> I am trying to add this info into a table and I know there is a way to
> do it without using the insert command on every line of data.
>
> 201 200 NJ Jersey City
>
> INSERT INTO categories VALUES ('201', '200', 'NJ', 'Jersey City');
>
> there are way too many lines to do by manual inserts.
> Any comments would help. Thanks
> Paul
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]