- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- AWK HELP PT TWO.
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
Discussions
Discussions
Forums
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
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 10:34 AM
тАО08-29-2002 10:34 AM
Yes its me the large pain in the neck.
I am attaching the output from the listed script below. I seem to be having 2 problems here.
1) The 1st columm which seems to be the listed in the top 1/2 of the output file instead of in the table location under the title heading jobid.
2)I cannot figure out why the output for the columm status (columm 2) is printing as the word STATUS instead of the value of STATUS (which could be 0,1,49,150...etc) plus the background color which is specified there as either GREEN for 0 or 1, or RED for other.
Thank you for your help.
###########################################################################
#
# This section of the script will execute the bpdbjobs command utilizing
# the file /home/fgrosb01/.xbpmonrcfg as it's configuration file for the
# output.
bpdbjobs -header -report -format ${BASEDIR}/.xbpmonrcfg > ${INPUT_FILE}
cat ${INPUT_FILE} | awk '{
jobid=substr($0,1,10);
jobtype=substr($0,12,11);
jobstate=substr($0,24,8);
status=substr($0,33,8);
class=substr($0,42,27);
schedule=substr($0,70,18);
client=substr($0,89,26);
mediaserver=substr($0,116,26);
started=substr($0,143,21);
elapsed=substr($0,165,14);
ended=substr($0,180,21)
Kbytes=substr($0,202,13);
files=substr($0,216,13);
compestimated=substr($0,230,11);
if ('status' == 0 || 'status' == 1)
status="status"
else
status="status"
printf("%s%s%s%s%s%s%s%s%s%s\n",jobid,sta,
Kbytes,files,compestimated);
}' > ${TMP_FILE}
print "
print "" >> ${OUTPUT_FILE}
print "" >> ${OUTPUT_FILE}
print "
jobid | status | client | class | schedule | started | >ended | kbytes | files | %completed |
print "" >> ${OUTPUT_FILE}
uuencode ${OUTPUT_FILE} ${OUTPUT_FILE} | $MAIL -m -s "Netbackup Jobs Report ${SCRIPT_EXECUTION_TIME}" ${ADDRESS}
exit 0
mmdcux17@/home/fgrosb01#
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-29-2002 10:39 AM
тАО08-29-2002 10:39 AM
Solutionif (status == 0 || status == 1)
status="" status ""
else
status="" status ""
status has to be outside the double quotes.
Hope this helps...
-- Rod Hills
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-29-2002 10:43 AM
тАО08-29-2002 10:43 AM
Re: AWK HELP PT TWO.
if (status == "0" || status == "1")
Now I am really going to confuse you because the above example assumes that status is string context. If you really want to do this correctly (and I assume status is really numeric) then
first change
status = substr($0,33,8)
to
status = substr($0,33,8) + 0
The + 0 is an awk idiom to force numeric context on an expression.
then the comparison should be
if (status == 0 || status == 1)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-29-2002 10:46 AM
тАО08-29-2002 10:46 AM
Re: AWK HELP PT TWO.
That answer was right on about the status field problem (problem #2). The codes are actually showing up and the background color is there.
Now the only thing left is why the jobid output is printing out above the table in the output file and not in its assigned columm.
Thank you rodney.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-29-2002 10:57 AM
тАО08-29-2002 10:57 AM
Re: AWK HELP PT TWO.
I have included that into the script too, that was a new one to me. BTW I am still having issues with the jobid output field printing above the table instead of it being lined up in its assigned place. Any Clue?.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-29-2002 10:57 AM
тАО08-29-2002 10:57 AM
Re: AWK HELP PT TWO.
printf("%s%s<
should (maybe?) be:
printf("%s<
Tom
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-29-2002 11:05 AM
тАО08-29-2002 11:05 AM
Re: AWK HELP PT TWO.
It would probably be easier to see what's wrong if you attached your source and the output file. Sample input data would certainly make it easier to know what's wrong.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-29-2002 12:37 PM
тАО08-29-2002 12:37 PM