- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: AWK Help Please.
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2002 05:48 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2002 05:54 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2002 05:57 AM
08-29-2002 05:57 AM
Re: AWK Help Please.
# if [ "$status" = 1 -o "$status" = 2 ]
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2002 06:01 AM
08-29-2002 06:01 AM
Re: AWK Help Please.
when i tried your statement change for the if statement this is the output that i get:if [[ ${status} -eq 0 || ${status} -eq 1 ]]
then
status="$status";
else
status="$status";
fi
printf("%s%s%s%s%s%s%s%s%s%s\n",jobid,sta,
Kbytes,files,compestimated);
}' > ${TMP_FILE}
syntax error The source line is 17.
The error context is
if >>> [ <<< [ ${status} -eq 0 || ${status} -eq 1 ]]
awk: The statement cannot be correctly parsed.
The source line is 17.
syntax error The source line is 19.
Is there something like maybe a ; that has to go at the end of the if,then,else statements since its located in the middle of an AWK statement?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2002 06:08 AM
08-29-2002 06:08 AM
Re: AWK Help Please.
the lines:
if [ $status is "0 or 1" ] ; then
status="$status";
else
status="$status";
fi
are shell-script-like.
When you want this in awk it should be:
if(status == "0" || status == "1)
status="" status "";
else
status="" status "";
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2002 06:11 AM
08-29-2002 06:11 AM
Re: AWK Help Please.
i've missed a quote:
if(status == "0" || status == "1")
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2002 06:11 AM
08-29-2002 06:11 AM
Re: AWK Help Please.
Oops, I missed that fact that it was part of the 'awk'. Therefore:
# {if ($status==0 || $status==1) {...} else {...}}
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2002 06:28 AM
08-29-2002 06:28 AM
Re: AWK Help Please.
Each of these suggestions has been very helpful, but I must be missing something since I am still getting this message:
if ($status==0 || $status==1);
then
status="$status";
else
status="$status";
fi
printf("%s%s%s%s%s%s%s%s%s%s\n",jobid,sta,
Kbytes,files,compestimated);
}' > ${TMP_FILE}
syntax error The source line is 20.
The error context is
>>> else <<<
awk: The statement cannot be correctly parsed.
The source line is 20.
Does the ELSE statement have a problem the way it is or do I have to do a else; ? or am I looking in the wrong place.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2002 06:35 AM
08-29-2002 06:35 AM
Re: AWK Help Please.
drop the '$', it should be simply 'status' rather than '$status'. (I know you use $1,$2, ... but this is awk; you want consistancy?)
also you need to watch semicolons;
if (status == 0 || status == 1); <-- WRONG; no semicolon
AND
= is an assignment; == is a comparison
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2002 06:45 AM
08-29-2002 06:45 AM
Re: AWK Help Please.
Note again:
{if ($status==0 || $status==1) {...} else {...}}
There is no "then" word in 'awk'...
Regards!
...JRF...