#!/bin/bash # Print usage if no argument is given if [ -z "$1" ]; then cat < ... _____________________________________ Anderson M. Winkler FMRIB / University of Oxford Jul/2013 http://brainder.org EOU exit fi if [[ $# -lt 2 ]] ; then echo "Error: Insufficient arguments." exit 1; fi csvfile=$1 shift cut -d " " -f 5 $1 > ${csvfile} shift while (( $# )); do cut -d " " -f 5 $1 | paste -d "," ${csvfile} - >> ${csvfile}.TMP__ mv ${csvfile}.TMP__ ${csvfile} shift done exit 0;