#!/bin/csh -f if ( $1 == '' ) then @ cols = 4 else @ cols = $1 endif set tmp = "/tmp/column.tmp" tee $tmp 2> /dev/null set l = `wc -l $tmp | tr -s " " "" | cut -f2 -d' '` @ totlin = $l / $cols @ count = 1 @ break = 0 while ( $count <= $l ) set line = `head -n $count $tmp | tail -1` @ count++ @ break++ if ( $break == $cols ) then /usr/bin/echo $line @ break = 0 else echo -n $line " " endif end echo " " rm -f $tmp