Computing.Net > Forums > Unix > Korn shell variable help

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Korn shell variable help

Reply to Message Icon

Name: Lucas
Date: May 7, 2003 at 13:03:49 Pacific
OS: tru64 5.1 1885 alpha
CPU/Ram: 10/8gb
Comment:

OK so i'm trying to assign something to a variable... heres what i'm trying to do

This command works fine outside of the script ($month and $day are assigned already)
cat test |grep "$month $day" |grep "Savegroup: (notice) Oracle completed, 1 clients(s) (All Succeeded)" | awk '{ pri
nt $1,$2, $9, $11, $13, $14 }'

i want to do like a b= the above line
but no matter how i put it in the script i always get some error ot it doesn't seem to work, i've tried putting "'s around it and ()'s but still no luck.... What am i doing wrong here guys, is it just not possible to assign that to a variable?

Thanks in advance
Lucas



Sponsored Link
Ads by Google

Response Number 1
Name: Lucas
Date: May 7, 2003 at 13:07:34 Pacific
Reply:

Some more info, using the actual location i will be pulling info from.

b=(cat /nsr/logs/messages |grep "$month $day" |grep "Savegroup: (notice) Oracle completed, 1 clients(s) (All Succeeded
)" | awk '{ print $1,$2, $9, $11, $13, $14 }')

I've tried that and tried replacing the outter () with "". I'm new to this so i'm unsure of if that proper or not.

Error i get:

May 7 Oracle 1 client(s) (All Succeeded)
bd2.ksh[13]: syntax error at line 13 : `(' unexpected


Thanks,
Lucas


0

Response Number 2
Name: LANkrypt0
Date: May 7, 2003 at 13:28:18 Pacific
Reply:

One tip, get rid of cat, just use
grep "$month $day" /nsr/logs/messages

You would need to put ` around the thing you are trying to do.

So
b=`grep "$month $day" /nsr/logs/messages|grep "Savegroup: (notice) Oracle completed, 1 clients(s) (All Succeeded)"|awk '{print $1,$2, $9, $11, $13, $14 }'`


0

Response Number 3
Name: WilliamRobertson
Date: May 7, 2003 at 16:21:43 Pacific
Reply:

Alternatively ksh version of `expression` is $(expression), which can be more flexible as it nests better.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: Korn shell variable help

Korn Shell script help please!! www.computing.net/answers/unix/korn-shell-script-help-please/4345.html

Korn shell script help ! www.computing.net/answers/unix/korn-shell-script-help-/7240.html

korn shell script help www.computing.net/answers/unix/korn-shell-script-help/3815.html