Sponsored Content
Top Forums Shell Programming and Scripting Need urgent help with korn shell script Post 302718769 by agama on Saturday 20th of October 2012 09:57:25 PM
Old 10-20-2012
Agree with spacebar -- can be simplified. My thoughts:

Code:
lswpar  | awk '
    /^Name/ { next; }
    /^---/  { next; }
    { state[$2] = state[$2] $1 " "; }
    END {
        printf( "==== WPAR Status Check =====\n" );
        printf( "**** WPAR state Active:\n\t%s\n\n", state["A"] );
        printf( "**** WPAR state Defined/Transition/broken:\n\t%s %s %s\n", state["D"], state["T"], state["B"] );
    }
' | mail -s "WPAR `hostname` Server monitoring Status of Client WPARs" unix_support@xyz.com

As to the reason for your error, you cannot use a shell variable ($i in this case) like you are attempting (in single quotes shell will not expand it). You could try:

Code:
check=$(awk 'FNR == I {print}'  I=$i  /tmp/wpar_state_ck.out)

But I would try something that is much more straight forward than the way you were approaching it.

Last edited by agama; 10-20-2012 at 11:12 PM.. Reason: fixed cut/paste truncation.
This User Gave Thanks to agama For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

demineur in korn shell:urgent.

hello. have please a demineur programmed in shell korn (unix).???? can you send it to me??? thanks. (0 Replies)
Discussion started by: raul
0 Replies

2. UNIX for Advanced & Expert Users

Minesweeper in korn shell:urgent

if you have the programme of Minesweeper;take me it because i need it. thank u very much. (1 Reply)
Discussion started by: raul
1 Replies

3. UNIX for Dummies Questions & Answers

korn shell script

hello., i have 2 files.. 1 file is in this folder /home/test/ssk/DSA.WLG.20050713211544.20050710.20050713211544 (this part) other file is in this folder /home/kk/dev/DSA.WLG.20050711210100.20050710.20050711210100 ... (1 Reply)
Discussion started by: pavan_test
1 Replies

4. UNIX Desktop Questions & Answers

korn shell script

hi all i am writing the korn shell script. i have a SQL script which gives me the folowing output DSA.WLG.20050713211544.20051025.20050713211544 28991 1130198400 DSA.WLG.20050713211544.20051025.20050713211544 25881 1130198400 DSA.WLG.20050711210100.20051025.20050711210100 25881 ... (3 Replies)
Discussion started by: pavan_test
3 Replies

5. AIX

Help with Korn Shell script

I have this Korn shell script that runs via a cron entry. It runs in a loop "watching" a specific file system for files with a certain name. The file system that it is watching is an upload file system for an FTP server. When files that are the correct name come in, it takes the extension of the... (1 Reply)
Discussion started by: heprox
1 Replies

6. Shell Programming and Scripting

Urgent Korn Shell scripting Help Pleaaaase...

Hello All, Can someone help me to set a user's password from the script using korn shell. The password change is a one time password after user account creation. I tried providing the input file as the value for password field but password change requires tty so my password from an input file... (3 Replies)
Discussion started by: solaix14
3 Replies

7. Shell Programming and Scripting

Korn Shell Script

I have to solve some exercises in Korn Shell, but i'm having some problems. For example: Write a korn shell script with an alfanumeric string as argument. The script lists the file's names in the current directory that contain the given string as substring and that can be read and written. I... (3 Replies)
Discussion started by: burm
3 Replies

8. Homework & Coursework Questions

Korn Shell Script

1. The problem statement, all variables and given/known data: Write a korn shell script with an alfanumeric string as argument. The script lists the file's names in the current directory that contain the given string as substring and that can be read and written. 2. Relevant commands, code,... (3 Replies)
Discussion started by: burm
3 Replies

9. Shell Programming and Scripting

pass null value to sql script from korn shell script

There are 4 parameters that I have to pass from korn shell to sql script. 1) I have to check if $1 , $2 , $3 and $4 are null values or not . How can I do that ? 2) Once its determined that these values are null (in the sense they are empty) how can I pass null values to sql script... (11 Replies)
Discussion started by: megha2525
11 Replies

10. Shell Programming and Scripting

URGENT Reading a file and assessing the syntax shell script URGENT

I am trying to write a shell script which takes an input file as an arguement in the terminal e.g. bash shellscriptname.sh input.txt. I would like for the file to be read line by line each time checking if the .txt file contains certain words or letters(validating the syntax). If the line being... (1 Reply)
Discussion started by: Gurdza32
1 Replies
QwtPickerMachine(3)						 Qwt User's Guide					       QwtPickerMachine(3)

NAME
QwtPickerMachine - A state machine for QwtPicker selections. SYNOPSIS
#include <qwt_picker_machine.h> Inherited by QwtPickerClickPointMachine, QwtPickerClickRectMachine, QwtPickerDragPointMachine, QwtPickerDragRectMachine, and QwtPickerPolygonMachine. Public Types enum Command { Begin, Append, Move, End } typedef QList< Command > CommandList Public Member Functions void reset () void setState (int) int state () const virtual CommandList transition (const QwtEventPattern &, const QEvent *)=0 virtual ~QwtPickerMachine () Protected Member Functions QwtPickerMachine () Detailed Description A state machine for QwtPicker selections. QwtPickerMachine accepts key and mouse events and translates them into selection commands. See also: QwtEventPattern::MousePatternCode, QwtEventPattern::KeyPatternCode Member Enumeration Documentation enum QwtPickerMachine::Command Commands - the output of the state machine. Constructor &; Destructor Documentation QwtPickerMachine::~QwtPickerMachine () [virtual] Destructor. QwtPickerMachine::QwtPickerMachine () [protected] Constructor. Member Function Documentation void QwtPickerMachine::reset () Set the current state to 0. void QwtPickerMachine::setState (intstate) Change the current state. int QwtPickerMachine::state () const Return the current state. virtual CommandList QwtPickerMachine::transition (const QwtEventPattern &, const QEvent *) [pure virtual] Transition. Implemented in QwtPickerClickPointMachine, QwtPickerDragPointMachine, QwtPickerClickRectMachine, QwtPickerDragRectMachine, and QwtPickerPolygonMachine. Author Generated automatically by Doxygen for Qwt User's Guide from the source code. Version 5.2.2 Mon Aug 1 2011 QwtPickerMachine(3)
All times are GMT -4. The time now is 09:10 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy