Skip to content

Known bugs #17

Closed Answered by Stagyrite
eltikia asked this question in Q&A
Discussion options

You must be logged in to vote

Yes, there are, and here's an example. Let's assume you check how much memory 'postgres' uses. This can be done by executing:
echo "q" | top -b | grep "postgres" | awk -F " " '{ memory += $10 } END { print memory }
Let's assume the numbers were: 0.2, 3.6, 3.5, 0.1, 0.0, 0.0, 3.7, 1.0, 0.6, 0.4, 2.4, 2.5, 2.3, 2.5, 0.4, and 0.4. The output number is 23.6, and it's a valid percentage value. Here's a Perl 1 program generated with the Awk to Perl translator from the 'x2p' subdirectory. It's a slightly modified version of it.

#!./perl
eval '$'.$1.'$2;' while $ARGV[0] =~ /^([A-Za-z_]+=)(.*)/ && shift;
                        # process any FOO=bar switches

$, = ' ';               # set output f…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by eltikia
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants