Hello,
I have a problem with saving output from awk to a file. The commands I tried:
Code:
$ top | awk '/Cpu|Mem/ {if ($1 ~ /Cpu/) {printf strftime("%H:%M:%S")"\t"; printf strtonum($3)"\t";} if ($1 ~ /Mem/) {printf ($5/$3)*100; printf "\n";}}' > file.out
and
Code:
$ top | awk '/Cpu|Mem/ {if ($1 ~ /Cpu/) {printf strftime("%H:%M:%S")"\t"; printf strtonum($3)"\t";} if ($1 ~ /Mem/) {printf ($5/$3)*100; printf "\n";}}' &> file.out
In both cases file.out is empty. What am I doing wrong? Thanks!
Evgeniy