I have two main directories say, A and B. Each of them contains 100 sub directories (a1,a2,.. and b1,b2,...) with random name. Those sub directories contain a file of XY type. The X value is same for a particular sub directory say a1 and b1 but the Y value is different. I now can create a XY type file where Y will be the difference between the sub directories Y column only, say Y = Y1(a1) - Y2(b1) with a simple awk command or so. But I don't know how to do this with a bash loop for all the sub directories. What I want a desired script which will create directories 1, 2,.. where each of the directory will contain a XY type file and the XY type files contain X Y(a1-b1) in directory 1, X Y(a2-b2) in directory 2,.., X Y(a100-b100) in direcotry 100. I am quite new in bash so apologize for any trivial question.
Schematic example can be like this:
I have two main directories A and B. A has sub directories 0.3427/ 0.3514/ 0.3543/ 0.3792/... and B has sub directories 0.4011/ 0.4014/ 0.4031/ 0.4357/....
0.3427/ sub directory of A contains the data file:
0.00 -8.79583
50.00 -8.79621
100.00 -8.79961
150.00 -8.80721
200.00 -8.81845
250.00 -8.83271
300.00 -8.8495
and 0.4011 sub directory contains the data file:
0.00 -8.78888
50.00 -8.78954
100.00 -8.79458
150.00 -8.80459
200.00 -8.81852
250.00 -8.83561
300.00 -8.85529
Now I want in directory 1 there should be a file say data.dat with the following data:
0.00 0.00695
50.00 0.00667
100.00 0.00503
150.00 0.00262
200.00 -7e-05
250.00 -0.0029
300.00 -0.00579
This desired data.dat file is just the difference of column Y of first sub directories of A and B which can be produce by an awk/paste command. Now I want the same for all the other sub directories present in the A and B. where in directory 2 the data.dat file should contain the difference in Y column of 0.3514/ of A and 0.4014/ of B and so on.