Last night I saw a very interesting Japanese film, Tokyo Sonata, I am not sure I would recommend it from an entertainment perspective, but if you are looking for something curious that really embodies Japanese mentality this seems to me to be one to watch.
Archive for November, 2009
This is just something I was wondering about, whether I could back up specific rows I am going to modify during test, so I can re-insert them all after I have finished and deleted my test data.
To selectively dump just specifc rows from your mysql table you can use the following:
mysqldump --where="domain_id='7'" -t -umyueser mydatabase mytable > mydumpfile.sql
Omitting the “-t” option will also place the drop and re-create table SQL into your dumpfile. It can be handy if you just want to backup a specific set of data from your db. Note it does not create REPLACE INTO’s though so you would need to delete the matching rows before restoring from such a dumpfile.
You can globally replace the INSERT INTO statements with REPLACE INTO using the following command
sed -i 's/INSERT INTO `metadata`/REPLACE INTO `metadata`/g' mydumpfile.sql
Another geeky posting, but something I could not find on google, how to pipe a specific list of files into rm on linux in order to delete them. I also found some crazy postings about how to get find to not search recursively so thought I would share what seemed to work for me.
It’s worth reading the man pages for find, xargs and rm.
This will find all the items in the current directory that are 6632 bytes in size and prompt for deletion for each.
find -maxdepth 1 -size 6632c | xargs –interactive rm -f