Monday, February 28, 2011

Curl to download a file

curl -C - -O http://www.mirror.com/path/to/file.zip

Thursday, February 10, 2011

Mysql

To dump data from mysql table to txt file:

mysqldump --no-create-info --extended-insert=FALSE --compact  psydex_rss_twitter MESSAGES > /tmp/testinsert.sql

(--extended-insert makes every row it's own insert statement)



SELECT col1,col2,col3
INTO OUTFILE '/tmp/file.csv'
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\n'
FROM table_here
WHERE col1 > 857461

LOAD DATA LOCAL INFILE '/tmp/file.csv'
INTO TABLE table_here
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\n';