#!/bin/sh if [ $# -ne 1 ] then echo "usage: $0 result-directory" exit 0 fi dir=$1 echo "from data (.d) to truncated data (.t)" for i in $dir/*.d do fname=$(echo $i | sed "s/[.]d$/.t/") awk '{ print $2, $3, $5 }' < $i > $fname done