command-line magic

Bulk process RAW image files

Posted on May 29, 2015 by

Recently I had to convert about 250 RAW image files to PNGs. For neatness, I wanted to convert the upper-case filenames the camera assigned with a lower-case name. A little bash script-fu is all it took: clean_pics.sh #!/bin/bash # Extract from SD Card for i in /Volumes/SDCARD/DCIM/100ND40X/DSC_0*; do filename=$(basename “$i”) lower_file=”$(echo $filename | tr ‘[A-Z]’ […]

Bulk fix a list of words to the proper case

Posted on August 9, 2012 by

Problem Given a long list of upper-case words (one word per line), such as: MARY JOE SCOTT FRED … (for thousands of rows) … You want to change this to Mary Joe Scott Fred (etc) Solution Use perl from the command line. Assume all your names are in a file called ‘names.txt’. We’re going to […]

What are your top commands?

Posted on December 15, 2011 by

Sometimes it is interesting to navel-graze. What commands do you type the most? history | awk ‘{a[$2]++}END{for(i in a){print a[i] ” ” i}}’ | sort -rn | head Here’s mine: 95 ll 93 git 67 cd 37 vi 29 identify 15 find 12 agvtool 11 history 11 exit 10 cat “ll” is an alias for […]