Aligning qhost output on the commandline when hostnames are too damn long

qhost is a UNIX command line tool to print the status of nodes on a Grid Engine system. The output is normally quite readable and is sorted by columns to give information on the hostname (“HOSTNAME”), architecture (“ARCH”), no. of CPUs (“NCPU”), processor load (“LOAD”), total available memory (“MEMTOT”), current memory usage (“MEMUSE”), swap memory size (“SWAPTO”) and current swap usage (“SWAPUS”) of each node on the cluster. Unfortunately, when the hostnames are too long, instead of truncating them to keep the columns aligned the row gets shunted along, making the output messy and much harder to read quickly....

September 24, 2014 · Simon