Miscellanea

To calculate the average or the maximum of the second column of data files, do

awk '{sum += $2} END {printf ("%f\n", sum/NR)}' $1

or

awk 'BEGIN {max = 0} {if ($2>max) max=$2} END {print max}' $1

The latter one is particularly useful for a quick-and-dirty plot of normalized spectra with gnuplot.


The easiest way to get the geometry of an image is

identify -format "%wx%h\n" *

To enable applications requiring X to be started with root rights without having access to kdesu or gksu, steal the magic cookie from your users 😄

xauth add `xauth -f ~user/.Xauthority list $DISPLAY`