need help generating this output


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting need help generating this output
# 8  
Old 09-17-2010
Code:
iostat -en | awk '{print ($2)?"Hardware errors":X}'
Hardware errors
Hardware errors

Code:
s/w h/w trn tot device
    2   0   0   2 c1t0d0
    3   0   0   3 c0t0d0
    2   0   0   2 c1t2d0
    0   0   0   0 c4t600A0B80005A4D130000039F4A4689B8d0
    0   0   0   0 c4t600A0B80005A4D15000003954A468A59d0
    2   0   0   2 c4t600A0B80005A4D13000003A14A468B24d0
    2   0   0   2 c4t600A0B80005A4D15000003964A468BE9d0
    2   0   0   2 c4t600A0B80005A4D13000003A24A468C64d0
    2   0   0   2 c4t600A0B80005A4D15000003974A468E29d0
    2   0   0   2 c4t600A0B80005A4D13000003A34A468EDCd0
    0   0   0   0 c4t600A0B80005A4D15000003994A468F7Fd0

even though its zero its showing hardware errors?

---------- Post updated at 01:08 AM ---------- Previous update was at 01:06 AM ----------

thats not the kind of O/p i want as said before i am trying to check if the device has any hardware errors or not

Last edited by Franklin52; 09-17-2010 at 09:20 AM.. Reason: Please use code tags!
# 9  
Old 09-17-2010
Ok, paste your expect O/P here.
# 10  
Old 09-17-2010
device has 4 hardware errors,i have to check if h/w coloumn has zero in it and if there are more errors then that particular device has hardware errors.thanks again

example
c4t600A0B80005A4D130000039F4A4689B8d0 has 5 errors
# 11  
Old 09-17-2010
but we can't get your result from your sample data.

What 's meaning of 5 erros? where do you get it?
# 12  
Old 09-17-2010
Code:
iostat -en |awk '{ if ( $2 == 0 ) { print "      " }  else { print " Hardware errors "} }

does $2 check the entire coloumn if everything is zero.from the O/p you pasted

incase there are any error it should print that device has errors
Code:
iostat -en | awk '/^[0-9]/{if ($2 != 0 ) print "Hardware errors"}'

use to work before but now its not working anymore dont know why please help

Last edited by Franklin52; 09-17-2010 at 09:21 AM.. Reason: Please use code tags!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Generating histogram

Hi, I have 2 files with similar structure - reference and test that I would like to BIN both and generate the comparison. input files structure is: a 3 b 10 c 3 d 7 e 1 f 4 g 9 h 6 I would like the output to be (lets say both reference and test are the file above - no diff) BIN ... (3 Replies)
Discussion started by: yan1
3 Replies

2. UNIX for Beginners Questions & Answers

Split Command Generating Incomplete Output Files

Hello All, May i please know how do i ensure my split command would NOT generate incomplete output files like below, the last lines in each file is missing some columns or last line is complete. split -b 50GB File File_ File_aa |551|70210203|xxxxxxx|12/22/2010 20:44:58|11/01/2010... (1 Reply)
Discussion started by: Ariean
1 Replies

3. Shell Programming and Scripting

Generating password

Hi, I am new to shell scripting, my requirement is I have to generate password for Users automatically using script and it should send on mail on that particular date using crontab. how to do this? (1 Reply)
Discussion started by: manoj.solaris
1 Replies

4. Shell Programming and Scripting

Randomly selecting sequences and generating specific output files

I have two files containing hundreds of different sequences with the same Identifiers (ID-001, ID-002, etc.,), something like this: Infile1: ID-001 ATGGGAGCGGGGGCGTCTGCCTTGAGGGGAGAGAAGCTAGATACA ID-002 ATGGGAGCGGGGGCGTCTGTTTTGAGGGGAGAGAAGCTAGATACA ID-003... (18 Replies)
Discussion started by: Xterra
18 Replies

5. Shell Programming and Scripting

Help with generating a script

I am a biologist who is new to linux and am having difficulty generating a script to do what I want it to do! I have tried basic grep commands, but even that does not give me back the data I want. I have many files that are all currently in .xslx and I'm not sure if they need to be .csv or .txt... (16 Replies)
Discussion started by: kellywilliams
16 Replies

6. Web Development

Detecting browser locales/languages and generating output

We have a Java app that renders Localized text on user's browser session based upon browser language settings. The app reads the browser language settings and prepares the localized text. But recently we faced issues for Mozilla 5.0 version browser. Note our code works fine in IE. Taking an... (1 Reply)
Discussion started by: uunniixx
1 Replies

7. Shell Programming and Scripting

awk not generating the expected output

Hi, I am presently stuck in a csv file. INPUT CSV baseball,NULL,8798765,Most played baseball,NULL,8928192,Most played baseball,NULL,5678945,Most played cricket,NOTNULL,125782,Usually played cricket,NOTNULL,678921,Usually played EXPECTED OUTPUT CSV ... (7 Replies)
Discussion started by: scripter12
7 Replies

8. Shell Programming and Scripting

Generating Combinations

Hi, I need to generate all combinations upto n-1 level, if the input file looks like say, A B C D . . .... I need to generate all combinations such that first value remains constant and the remaning are combined with all possible ways. Output A AB AC AD ABC (1 Reply)
Discussion started by: zorg4u
1 Replies

9. AIX

Generating a Subsystem

Hello, I'm trying to generate a subsystem which supports startsrc, stopsrc and refresh I want to specify special arguments in case of stopsrc and refresh for example: startsrc: /bin/testscript start stopsrc: /bin/testscript stop refresh: /bin/testscript restart which should be... (0 Replies)
Discussion started by: funksen
0 Replies

10. Programming

generating timer

I'm trying generate an interrupt every 1 seconds using itimer and My clock is not running. This is what i did : printf("about to sleep for 1 second \n"); signal(SIGALRM, wakeup); //myTimer.it_interval.tv_sec=0; //myTimer.it_interval.tv_usec =0; ... (5 Replies)
Discussion started by: Confuse
5 Replies
Login or Register to Ask a Question