I have three different file sets say 10234.su, 10234.ph and 10234.th. I have a shell script using which I can extract some data from 10234.su and can write to 10234.ph and 10234.th, but it works for only one file at a time. I need a modification which can automatically read the files one by one (xxx.su) and write appropriately (xxx.ph and xxx.th). All the three files have always the same names. Exapmle - 10234.su, 10238.su, 10242.su etc. I have a lot of .su files with different names which I want to read one by automatically.
My script is as follows -
rm hdrfile binary
for i in *.su; do
sugethw <"$i" output=geom key=cdp >hdrfile
a2b <hdrfile n1=994 >binary
echo "$i -> sugethw <"$i" output=geom key=cdp >hdrfile a2b <hdrfile n1=994 >binary"
for j in *.ph; do
sushw <"$j" infile=binary key=cdp >test1.su
rm "$j"
mv test.su "$j"
echo "$j -> sushw <"$j" infile=binary key=cdp >test.su rm "$j" mv test.su "$j""
for k in *.th; do
sushw <"$k" infile=binary key=cdp >test2.su
rm "$k"
mv test.su "$k"
echo "$k -> sushw <"$k" infile=binary key=cdp >test.su rm "$k" mv test.su "$k""
rm hdrfile binary
done
done
done
Thanks!