With grep filter a file, from that filtered lines do a math operation on a specific column, only in the lines that contains a string "value=", return all the lines from the first grep filter and the lines where the math operation was done.
Example:
Use grep to filter lines that contains the string "update", this is easy, I got it.
output:
... col1 col2 update col4 col5 col1 col2 update value= 320 col1 col2 update col4 col5 col1 col2 update value= 210 ...
Now I need to select only the lines that contains the string "value=" and multiply the next column by 25, but still get lines that doesn't have the value= string
output:
... col1 col2 update col4 col5 col1 col2 update value= 8000 col1 col2 update col4 col5 col1 col2 update value= 5250 ...
I have tried using an if statement and awk, but only returns the lines where the math operation was done.
grep
when you're usingawk
.