Often it is useful to export a SQL query result into a file. Especially CSV files are nice for this task. The following SQL query saves the result in a file called output.csv into the /tmp directory: SELECT * FROM my_table INTO OUTFILE ‘/tmp/output.csv’ FIELDS TERMINATED BY ‘,’ ENCLOSED BY ‘”‘ LINES TERMINATED BY ‘\n’;
Archive for the ‘manual of the day…’ Category
‘look behind’ Regular Expressions in TextMate
I just had the problem that I wanted to remove line breaks which were located after normal characters. The solution was to use a ‘look behind’ Regular Expression, which is also supported by the awesome TextMate editor. This was my find expression: (?<=[a-z])\n and I replaced it with an empty string.
Install ImageMagick on Mac OS X using MacPorts
Image via Wikipedia The easiest way to install ImageMagick on a Mac system (Snow Leopard) is to download and install MacPorts: http://www.macports.org/install.php After installing MacPorts via the package installer just enter sudo port install ImageMagick and that’s it.
Find&Replace with vim
How to replace search with replace in a whole document using vim: :%s/search/replace/g
Backup data on a FTP server using rsync and curlftpfs
Sometimes it’s smart to backup data. :) For example database data. And it’s even smarter to save this backup data on a different server and not on the production machine. In my case I needed to save database dumps to a FTP server. To do this I used the tools curlftpfs and rsync. sudo apt-get [...]
Freezing Ruby on Rails applications
To freeze a Ruby on Rails application to a specific version of Rails (e.g: 2.3.5) just execute the following Rake command in your projects root directory. rake rails:freeze:edge RELEASE=2.3.5
Transfer a file to a remote server using lftp
I needed to copy a file (here: dummy.gz) to a remote ftp server (here: MY_FTP_SERVER.COM) and decided to use lftp as a tool for this. This is how it works: lftp -u login,password MY_FTP_SERVER.COM -e “put dummy.gz; exit “
Read lines from a file using the stream editor
To select and show specific lines in a file, you can easily do this by using the stream editor (sed): sed -n ’101,110p’ input.file
Installing Post-Commit-Hook for Subversion and Trac 0.11
If you have a Subversion running including a Trac connection, it’s nice to have the post-commit-hook running, too. With this hook, you can include additional keywords (closes, fixes) in commit-comments which then allow to close, fix etc. tickets. I installed it in the following way. My Subversion directory is in this case /svn and my [...]
How to remove repositories from Ubuntu via ppa-purge
Install ppa-purge from this site: https://launchpad.net/~xorg-edgers/+archive/ppa/+sourcepub/893290/+listing-archive-extra Just click the .deb file and install it. Then use it via command line. Here: Removing the Mozilla ppa: sudo ppa-purge ppa:ubuntu-mozilla-daily/ppa
Recent Comments