Hi,
I wanted to check whether the x,y,z coordinates of two files are equal or not. At times, when one file is converted to another suitable file extension , there are some chances that the data mismatch would happen during the conversion. In order to avoid the data misfit, i would like to compare the co-ordinates of the both files and check whether they are equal or not.
For example, following are the sample files :
File1 (here additional columns are intentional left, but in real file, there are around 10 columns)
x_coord y_coord z_coord ID
1.01 2.56 8.32 1
1.06 2.50 7.36 2
1.08 2.69 4.25 1
File2 (here additional columns are intentional left, but in real file, there are around 10 columns)
ID x_coord y_coord z_coord
1 1.01 2.56 8.32
2 1.06 2.50 7.36
1 1.08 2.69 4.25
Expected Output:
comp
0 0 0 0
0 0 0 0
0 0 0 0
Below, is the code i tried.
awk '{print $2,$3,$4,$5}}' file1 > xyz
awk '{print $2,$3,$4,$5}}' file2 > data
paste xyz data > inn
awk '{print $0,$1-$6,$2-$7,$3-$8,$4-$5}' inn > core
awk '{print $9,$10,$11,$12}' core > comp
rm xyz data inn core
The above code gives the desired result as displayed in the expected output. But, is there any other way of using the shell commands more efficiently. !!!!