Showing several data in one table


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Showing several data in one table
# 1  
Old 02-08-2009
Showing several data in one table

hi again :$

i am creating a script to be able to monitor a machine's performance.
the code in the file is:
================q==============
sar 2 3 |awk '{print $3}'
vmstat 2 3 |awk '{print $19 " " $21}'
iostat -cx 2 3 |awk '{print $8 " " $10 " " $13}'
================uq=============
the result of this code is the data i want but in several table (several output)

I want to collect all the output in one table.
in example:
==========
svc sys %b.....
2 4 6
2 3 9
3 2 3
==========

any idea?? Smilie


thx
# 2  
Old 02-08-2009
I found this code online, but couldn't make it works.
========================
#!/bin/ksh

for x in $@
do
sed -n '/YOURTERM/p'|sed 's/^.*(YOURTERM).*$/\1/'
done
=======================
can any one help me plz?
# 3  
Old 02-08-2009
Quote:
Originally Posted by mohamedh_14
hi again :$

i am creating a script to be able to monitor a machine's performance.
the code in the file is:
================q==============

Please use [code] tags for code rather than [COLOR].
Quote:
...SNIP...
any idea?? Smilie

What does the output of the commands look like?

How does that relate to your desired output?
# 4  
Old 02-08-2009
Quote:
Originally Posted by mohamedh_14
I found this code online, but couldn't make it works.

In what way did it not work?
Quote:
========================

Please put code inside [code] tags.
Quote:
Code:
#!/bin/ksh 
 
for x in $@ 
do 
     sed -n '/YOURTERM/p'|sed 's/^.*(YOURTERM).*$/\1/' 
done

=======================

I'd avoid wherever you found that piece of code.

Fixed, it might be:

Code:
for x in "$@"
do 
     sed -n 's/.*\(YOURTERM\).*/\1/p'
done

What are you trying to do with it?
# 5  
Old 02-09-2009
thanx for correcting,
i am trying to have several data in one table.

for more description, i need to have the 3rd column from "sar", the 19th and the 21th from "vmstat" in one table.

to be presented like that:

%sys sy cs
3 2 3
2 3 4

is that more described?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Tabulate data in a table.

I have about a million tables stored as .txt files in a directory. The content of the files look like this: ages-eligible-for-study: genders-eligible-for-study: accepts-healthy-volunteers: CONTINUE 18-months-to-36-months both yes CONTINUE DONEOther examples, CONTINUE... (8 Replies)
Discussion started by: shoaibjameel123
8 Replies

2. AIX

LPAR2RRD showing no data?

Just installed LPAR2RRD tool onto AIX box following official guide. Everything looks fine, able to view the browser and see the HMC and associated LPARs. Likewise the CGI-BIN of the web server works fine. Data has been successfully loading in via the first run of the "load.sh" script...... (0 Replies)
Discussion started by: kennygratts
0 Replies

3. Shell Programming and Scripting

Arrange data in table

Hello All, I have following data into my file named record. Name City phone number email Jhon Newyork 123456987 jhon@gmail.com Maria Texas 569865612 Maria_Sweet@rediffmail.com Chan Durben NA Chan123@gmail.com The output should be in straight columns.. There should not be any... (1 Reply)
Discussion started by: Nakul_sh
1 Replies

4. Shell Programming and Scripting

Arrange data in table

Hello All, I have following data into my file named record. Name City phone number email Jhon Newyork 123456987 jhon@gmail.com Maria Texas 569865612 Maria_Sweet@rediffmail.com Chan Durben NA Chan123@gmail.com |---------------------------------------------------------------| |Name ... (2 Replies)
Discussion started by: Nakul_sh
2 Replies

5. Shell Programming and Scripting

Excel file attachment showing data in single column

Hi All, found similar posts, but not exatcly what i wanted. I have an text file like below and am trying to send mail as an excel file but when i get the excel file as the attachment, all the data is coming in the first column. I need below data in 4 columns. Unix file Name,ID,Trade,Date... (3 Replies)
Discussion started by: robinbannis
3 Replies

6. Shell Programming and Scripting

How to take data from table?

Hi all , am using unix aix .. Actually i have a table called table 1 in that table year period startdate enddate 2013 1 26/03/2012 29/04/2012 2013 2 30/04/2012 27/05/2012 2013 3 28/05/2012 28/06/2012 2013 4 25/06/2012 ... (10 Replies)
Discussion started by: Venkatesh1
10 Replies

7. UNIX for Dummies Questions & Answers

Filetype conversion error (showing ascii instead of data)

Hi I have spool file data UTF file containing Header data footer when there is data my file type is UTF FORMAT. that is typing file file1.utf output is data but when there is no records of data if only shows Header and footer then the flletype is ASCII... why this happen? Pls... (2 Replies)
Discussion started by: shenthil76
2 Replies

8. UNIX for Dummies Questions & Answers

Append data 1 table to other

Hi. I have 2 create 2 temporary tables.the data will be same with same cols..but after creating 2 tables..i have to merge data in file and send..however the query is after merging data no duplicates shud be present..and only 1 record for a entity must be present.. for eg: table1 has foll cols... (3 Replies)
Discussion started by: musu
3 Replies

9. UNIX for Advanced & Expert Users

Data from table to column

Hi All, in bash I have a text file which is something like 7.96634E-07 1.0000 0.00000E+00 0.0000 0.00000E+00 0.0000 1.59327E-06 0.7071 2.23058E-05 0.1890 6.61207E-05 0.1098 1.13919E-04 0.0865 1.47377E-04 0.0747 .... .... 0.00000E+00 0.0000 0.00000E+00 0.0000 ... (6 Replies)
Discussion started by: f_o_555
6 Replies

10. Shell Programming and Scripting

Data table

Hi there, I get a list of data set by means a script with many echo command that looks like this: CASE 1 A= 4 B= 4 CASE 2 A= 3 B= 5 Is... (3 Replies)
Discussion started by: Giordano Bruno
3 Replies
Login or Register to Ask a Question