#!/bin/sh filename=stim1.txt tr=3.5 for cond in b1 b2 ; do times=`grep ${cond} $filename | awk '{print $3}'` for t in $times ; do tsec=`echo $t \* $tr | bc` echo "$tsec 30.0 1.0" >> stim1_${cond}.txt done done