Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
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

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

One tip, get rid of cat, just use
grep "$month $day" /nsr/logs/messagesYou 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 }'`

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

![]() |
![]() |
![]() |

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