hi,
I have a l-column file of more than 10,000 lines with interspersed negative values. What I want to do is add a fixed number (360) everytime a negative value is encountered while leaving the positive ones as is. I need something that will read every line of the file and do the calculation without changing the order of the data. any idea how to implement this using awk? Many thanks in advance.
sample file looks like the ones below:
original values desired output
135 135
123 123
144 144
-179 181 (-179+360)
-164 196 (-164+360)
156 156
145 145
-164 196 (-164+360)
156 156
-176 184 (-176+360)
and so on ..