kvok
1
I have an output from db which looks like :
row1 row2 row3
abc 21.1 13
efg 21.1 45
ghi 21.1 75
when I apply following command ( cat my_output.txt | awk {'print $ 4' }
I have following output :
row3
13
45
75
now I want to figure out if there is value greater than 70 if yes then create empty file flag.txt
any idea ?
Thanks
awk '{$3 > 70}' my_output.txt > flag.txt
rdcwayx
3
Create an empty file flag.txt if there is value greater than 70, whatever if the file flag.txt is exist or not.
awk '$3 > 70 {system ("> flag.txt")} ' my_output.txt
hi rdcwayz:
can you please explain the bold section in your logic
awk '$3 > 70 {system ("> flag.txt")} ' my_output.txt
Thanks
system ("> flag.txt") => Invokes a shell and executes the command which is within quotes. And you do know what "> flag.txt" does, right?