Saving awk output to file
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 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 Evgeniy |
Programs that update the console display usually won't work with redirects.
|
Use the -b (batch mode) flag for top. Have a look at the man page.
Cheers, Evo2. |
All times are GMT -5. The time now is 12:44 PM. |