awk on Solaris


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting awk on Solaris
# 1  
Old 04-03-2009
awk on Solaris

Hi,

we have a shell script like this ..

# make sure all parameters are dealt with in upper case.
for option in ${1} ${2} ${3} ${4} ${5} ${6} ${7} ${8} ${9}
do
option_name=`echo ${option} | awk -F \= '{print $1}'`
if [ "${option_name}" == "SID" ]
then
SID=`echo ${option} | awk -F \= '{print $2}'`
else
typeset -u option
eval ${option}
fi
done



it's working fine on AIX and it's failing on "option_name=`echo ${option} | awk -F \= '{print $1}'`" on Solaris . Syntax looks oky for me . And it's not giving exact error too .

do you see any thing different for Soalris 10 ( awk part)



Thanks
# 2  
Old 04-03-2009
Your line:
Code:
awk -F \= '{print $1}'

has a space between the "-F" and the "\=" which will cause it to fail in Solaris, also I would have written that as follows:
Code:
awk -F"=" '{print $1}'

# 3  
Old 04-03-2009
ThankYou . I will give it a try !!!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

awk command error in Solaris

I have the following code that works perfectly in Cygwin $ awk -F, ' BEGIN {months ="AP01"; months ="AP02"; months ="AP03"; months ="AP04"; months ="AP05"; months ="AP06"; months ="AP07"; months ="AP08"; months ="AP09"; months ="AP10"; months ="AP11"; months... (3 Replies)
Discussion started by: Raul_Rodriguez
3 Replies

2. UNIX for Dummies Questions & Answers

Converting HP-UX awk to Solaris

Hi, I am using awk in HP-UX to enter an encrypted entry of the password into /etc/passwd with success, this is the command I am using and it is working great. cat /tmp/passwd.gal.before|awk -F: -v gal_passwd="encrypted_password" '{OFS=":" ; print $1,gal_passwd,$3,$4,$5,$6,$7}' >... (3 Replies)
Discussion started by: galuzan
3 Replies

3. UNIX for Advanced & Expert Users

awk -v issue in Sun Solaris

Hi, awk -v is having issue in sun solaris, however the same works fine in HP Superdome. Pls advise what to do, while executing below command in SunOS. echo "this is saurabh"|awk -v a="SAURABH" '{ print a }' (2 Replies)
Discussion started by: sbaisakh
2 Replies

4. Shell Programming and Scripting

awk -F works on Linux, but not on Solaris

Hello, I found this command works on Linux: $ echo `uptime` | awk -F "load average: " '{ print $2 }' 1.60, 1.53, 1.46 but got error on Solaris: $ echo `uptime` | awk -F "load average: " '{ print $2 }' awk: syntax error near line 1 awk: bailing out near line 1 $ which awk... (2 Replies)
Discussion started by: seafan
2 Replies

5. Shell Programming and Scripting

awk script Error in Sun Solaris

Hi Friends, the below script has been through the errors in sun solaris. awk '/%s/{f=0 ;n++; print >(file="OUT_" n); close("OUT_" n-1)} f{ print > file}; /%s/{f=1}' $BASE_DIR/concat.TXT awk: syntax error near line 1 awk: bailing out near line 1 And ls $MERGE_DIR/*.R | awk ' { ... (2 Replies)
Discussion started by: krbala1985
2 Replies

6. Shell Programming and Scripting

System call using awk on Solaris

I'm brand new to awk and need your help. I want to be able to shut down my workstations when they become to hot (because we've lost our cooling). I found a really neat way to monitor the temperature of the system and a short, simple awk scipt to use with it: /usr/sbin/prtpicl -v -c... (2 Replies)
Discussion started by: natural
2 Replies

7. Shell Programming and Scripting

awk problem (Solaris vs Linux)

My overall goal is to parse a large log by date range - here's my code: awk '$0>=" This works fine with Linux but I get the following error with Solaris: awk: syntax error near line 1 awk: bailing out near line 1 Is there a known workaround for this problem? (1 Reply)
Discussion started by: bwatlington
1 Replies

8. Shell Programming and Scripting

awk and nawk on Solaris

Why do they do two different things? Like on one version of UNIX you can use awk, but tehn if you move to Solaris then awk becomes something crap and you need to use nawk instead! whY!?!?!?! (4 Replies)
Discussion started by: linuxkid
4 Replies

9. Shell Programming and Scripting

awk syntax for Solaris

Hi, Pass variable in SUN SOLARIS awk I have a file call text server1 10.0.0.2 When i use this awk command in Mac OS and Linux , everything works as expected. export HOSTNAME=server1 awk -v HOSTNAME=$HOSTNAME ' $1 ~ HOSTNAME { print $2 ; } ' text1 But when i entered the... (7 Replies)
Discussion started by: phamp008
7 Replies

10. Shell Programming and Scripting

awk in solaris

Friends, I have a awk script which will calculate values for columns which is working fine in linux but failing in solaris. here is my awk script iostat -dt $INTERVAL $ITERATION | awk 'NR>4' | egrep -v "Linux|Device|Time|AM|PM|sda" | awk '{if(/^$/){printf("%f \n" ,sum);... (13 Replies)
Discussion started by: achak01
13 Replies
Login or Register to Ask a Question