LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Need single table output from 2 sar command outputs (https://www.linuxquestions.org/questions/linux-newbie-8/need-single-table-output-from-2-sar-command-outputs-4175481279/)

mohdkmn 10-18-2013 05:48 AM

Need single table output from 2 sar command outputs
 
sar -r | awk '{print $1, $2, $5, $10}' -- output table 1 --

sar -f | awk '{pritn $4, $6, $4+$6}' -- output table 2

I need to join two tables output into single table, How?

Regards
mohdkmn

chrism01 10-18-2013 05:53 AM

Can you show some example outputs and what you want the result to look like, using code tags https://www.linuxquestions.org/quest...do=bbcode#code

mohdkmn 10-18-2013 11:36 PM

Dear Chris,

Thanks for your reply..

The output of sar -r | awk '{print $1, $2, $5, $10}' is,

12:00:01 AM %memused %swpused
12:10:01 AM 99.25 25.99
12:20:01 AM 99.26 25.99
12:30:01 AM 99.29 25.99
12:40:01 AM 99.26 25.99
12:50:02 AM 99.22 25.99
01:00:01 AM 99.27 25.99

The output of sar -f | awk '{pritn $4, $6, $4+$6}' is,

%user %system
0.79 0.59 1.38
0.74 0.58 1.32
0.72 0.59 1.31
0.79 0.61 1.4
0.79 0.61 1.4
0.72 0.58 1.3
0.78 0.61 1.39
0.81 0.63 1.44

I need a below output

Time %memused %swapused %user %system %CPU
12:10:01 AM 99.25 25.99 0.79 0.59 1.38
12:20:01 AM 99.26 25.99 0.74 0.58 1.32
12:30:01 AM 99.29 25.99 0.72 0.59 1.31

Thanks for Advance ..

jpollard 10-19-2013 06:32 AM

Both files need a common field (likely the time stamp). Without that, there is nothing to connect the record from the second file to the record of the first file.

Then you can use the "join" command to combine records.

grail 10-19-2013 09:30 AM

Not knowing the sar command, if you supply both switches on a single call will all the raw data be there to create the complete table? If so you would need to show the output from that command.


All times are GMT -5. The time now is 08:52 PM.