Swapping columns in a text file

September 22, 2007

An awk snippet to swap columns in a text file:

awk -F'[ ]' '{ print $2, ": ", $1 }' original.txt >swapped.txt

The '[ ]' is the separator in the original file (a regular expression). The ": " is the separator that is put in the result file.

You can also be done with cut and paste command line tools.


Thumbnails with ImageMagick

September 21, 2007

My command for making thumbnails with ImageMagick (should be a single line):

convert original.png -thumbnail ‘160×160>’ thumbnail.png

Just so I don’t have to wade through the tutorial every time I need to do it.

Note: those are single quotes: WordPress seems to switching them to some sort of fancy quotes that don’t work if you cut and paste.

Update: not only is WordPress screwing with the quotes, but it is making the x into a non-x multiplication sign.