LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-18-2013, 06:48 AM   #1
mohdkmn
LQ Newbie
 
Registered: Oct 2013
Posts: 2

Rep: Reputation: Disabled
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
 
Old 10-18-2013, 06:53 AM   #2
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,411

Rep: Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397
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
 
Old 10-19-2013, 12:36 AM   #3
mohdkmn
LQ Newbie
 
Registered: Oct 2013
Posts: 2

Original Poster
Rep: Reputation: Disabled
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 ..

Last edited by mohdkmn; 10-19-2013 at 12:46 AM.
 
Old 10-19-2013, 07:32 AM   #4
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,711

Rep: Reputation: 1279Reputation: 1279Reputation: 1279Reputation: 1279Reputation: 1279Reputation: 1279Reputation: 1279Reputation: 1279Reputation: 1279
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.
 
Old 10-19-2013, 10:30 AM   #5
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,550

Rep: Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Single audio stream to multiple outputs? exodist Linux - Hardware 1 11-13-2011 07:38 AM
sar output fernfrancis Linux - Newbie 3 03-21-2011 10:57 AM
shell script/command for converting columns/table onto a single line skuz_ball Programming 9 11-30-2007 04:02 AM
howto print output of mount command as a table? ygloo Programming 8 10-18-2006 02:32 PM
series-Write a single shell command to display the following output ricki Programming 2 07-31-2005 04:53 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:27 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration