I have attached a simple bash test script as follows. In which each command line works well, except the "awk '{print ($1-i)/(2)}' < file.dat > output$i.dat". In this script, I expect "i" should be the same number as the name given for its directory. "i" takes only the "0" value in each directory. $1 is the first column of the file.dat data file. It generates output$i.dat as per numbered directory. For example, if i=0, output0.0.dat, i=0.5, output0.5.dat etc. I am looking forward to your suggestions and hints for the same. Thanks in advance for your suggestions and hints.

#############################################

#!/bin/bash

mkdir work

for i in `seq -w 0.0 0.5 2.0`

do

cp -r work $i

cd $i

cp ../file.dat .

cp file.dat file-$i.dat

awk '{print ($1-i)/(2)}' < file.dat > output$i.dat

cd ..

rm -rf work

mkdir work

done

#############################################

With regards,

More Swapnil Deshpande's questions See All
Similar questions and discussions