Hello, I will like to delete/replace $3 with NaN. condition $3>-2000 (file1.dat) to produce out.dat. I want to retain the structure of the table. I use this code, this output only $3. Any idea on how to modify this code. Thank you.
What do you mean by "I want to retain the structure of the table"?
Why do you run the for loop across all fields if you want to operate on $3 only?
What are the two or ed branches in the if construct for?
Why is line 3 not NaN ned?
Thanks RudiC, I could just remove the fields with values above -2000, but I want to remain the structure such that I have a 4x4 matrix. then perform calculations only on the remaining values.
I made several attempts to operate only on $3, but couldn't so I decided to try another way, since $1 and $2 can't be affected by the condition (>-2000).
---------- Post updated at 03:35 PM ---------- Previous update was at 03:32 PM ----------
I also considered print $3, so I can apply the condition to it separately, but the whole fields are deleted and could not fit the 4x4 structure I intend to retain.
Help me out - what 4x4- matrix are you talking of? I see a 3 fields file n lines long. If you need to convert that to another matrix, post the rules / logics to be applied and people in here might be able to help.