Need help with awk scripting.

Hi, i am newbie to this site and hope to learn but problem is s but need help urgently.

Plz pm me if you are good at this.
Help will be appreciated.

I can't imagine that people will be queueing up to PM you - this is a forum after all, not a messaging service.

Post your question here. There is a forum for urgent help. If you have enough bits, post your question there.

Thanks Scott for your advice.

I need to write a script and I should mostly use:

while
if
for
print

Basically i have a cube model divided in the grids.
Let's say 24X6X4 and for each grid i have a value. like 5, 10,12.

So i have two files with the same grid dimensions: 24x6x4 of the cube and almost all of the values for each grid are the same except for few. So basically if all the values for each grid in both file would be the same, then: File1-File2 would be equal to 0.

I need to write a script which will say:

File1-File2, and if the value is not zero then print it and show in which X,Y,Z it is located.

Thanks

post an example i.e what is the input? and what is the desired output?

XYZ cube with 5x2x2 dimensions

Input File1:

5 4 7 X varies, J=1, Z=1
1 7

8 6 3 X varies, J=2, Z=1
5 6

3 2 7 X varies, J=1 Z=2
1 7

1 4 3 X varies, J=2 Z=2
5 8

Input file 2:

5 6 7
1 5

3 4 7
2 1

3 2 7
1 7

1 4 2
5 8

(Same structure For file 1 and file 2, first column Varying in X while Y and Z is constant of 1. for example first value is 5 is X=1, Y=1, Z=1; 4 is X=2, Y=1. Z=1 )

So i need to do the following:

File2-File1 and if the difference > 0 print with X,Y,Z coordinates.

what do you mean by file1-file2...example needed.

those numbers are in a txt file and that;s the file.

do you mean the below
(5) (6) (7) - (5) (4) (7) = 0 2 0 {print}
(1) (5) - (1) (7) = (0) (-2) {don't print}

is it necessary that all the coordinates (>0) or just one of them?

yes it is actually coz u most of the values are equal. and it has to show XYZ coordinates

what are these numbers in red bold font in file1 below:-

1 4 3 X varies, J=2 Z=2
5 8 

1 - X=1, Y=2 Z=2 ; 4 - X=2, Y=2, Z=2; 3 - X=3, Y=2 Z=2

Do the work on two steps with the condition that the format of File2 is similar to File1:-

step 1:-
paste File2 File1 > New_File
step 2:-
nawk '  
(NF ==4 ) {if ( ($1-$3) > 0 && ($2-$4) > 0 ){print} ; next }
{ if ( ($1-$4) > 0 || ($2-$5) > 0 || ($3-$6) > 0) {print} }'  New_File

:D:D:D