Specialty Forums
Security and Virus
General Hardware
CPUs/Overclocking
Networking
Digital Photo/Video
Office Software
PC Gaming
Console Gaming
Programming
Database
Web Development
Digital Home

General Forums
Windows XP
Windows Vista
Windows 95/98
Windows Me
Windows NT
Windows 2000
Win Server 2008
Win Server 2003
Windows 3.1
Linux
PDAs
BeOS
Novell Netware
OpenVMS
Solaris
Disk Op. System
Unix
Mac
OS/2

Drivers
Driver Scan
Driver Forum

Software
Automatic Updates

BIOS Updates

My Computing.Net

Solution Center

Free IT eBook

Howtos

Site Search

Message Find

RSS Feeds

Install Guides

Data Recovery

About

Home
Reply to Message Icon Go to Main Page Icon

Awk Help

Original Message
Name: Junes
Date: November 10, 2006 at 04:37:54 Pacific
Subject: Awk Help
OS: UNIX
CPU/Ram: NA
Model/Manufacturer: NA
Comment:
I have written a script which looks through a file, when a backup fails to output a releavnt message.

I am finding that when a backup fails with Status 1, all the Status_Messages that being with Status 1* in the nberrors_rules file is being reported, as shown above.

It should only report the following message.

STATUS_MESSAGE ^1$ See BOA-NBU-1. Partial success.


Can you help.


=========== SCRIPT =============
set -x

RULES=nberrors_rules_NEW
STCODE=1

MESSAGE=`awk <$RULES '/^STATUS_MESSAGE / && $2 ~ '/$STCODE/' { for(a=3;a<NF+1;a++) {printf "%s ",$a }}'`


=========== nberrors_rules_NEW =============

cat nberrors_rules_NEW

STATUS_MESSAGE ^1$ See BOA-NBU-1. Partial success.
STATUS_MESSAGE ^6$ See BOA-NBU-16. Failed to backup requested files.
STATUS_MESSAGE ^(14|24|40|41)$ See BOA-NBU-2. Network problems.
STATUS_MESSAGE ^(42|44|47|54)$ See BOA-NBU-2. Network problems.
STATUS_MESSAGE ^(56|58)$ See BOA-NBU-2. Network problems.
STATUS_MESSAGE ^(28|36)$ See BOA-NBU-3. System overloaded.
STATUS_MESSAGE ^(46|59)$ See BOA-NBU-4. Client config problems.
STATUS_MESSAGE ^50$ See BOA-NBU-5. Client process aborted.
STATUS_MESSAGE ^57$ See BOA-NBU-6. NetBackup client service not responding.
STATUS_MESSAGE ^(63|150)$ See BOA-NBU-7. Backup aborted.
STATUS_MESSAGE ^71$ See BOA-NBU-8. None of the files to backup exist.
STATUS_MESSAGE ^84$ See BOA-NBU-9. Media write error.
STATUS_MESSAGE ^96$ See BOA-NBU-10. No usable tapes found for backup.
STATUS_MESSAGE ^99$ See BOA-NBU-11. NDMP backup failure.
STATUS_MESSAGE ^121$ See BOA-NBU-12. No usable tapes found for catalog backup.
STATUS_MESSAGE ^196$ See BOA-NBU-13. Backup window closed.
STATUS_MESSAGE ^219$ See BOA-NBU-14. Storage unit is unavailable.
STATUS_MESSAGE ^252$ See BOA-NBU-15. Vault or synthetic backup failed.


=========== OUTPUT =============

SYSTEM:/tmp/Script_Test
+ RULES=/usr/openv/netbackup/BOA_scripts/nberrors_rules_NEW
+ STCODE=1
+ + awk /^STATUS_MESSAGE / && $2 ~ /1/ { for(a=3;a<NF+1;a++) {printf "%s ",$a }}
+ 0< /usr/openv/netbackup/BOA_scripts/nberrors_rules_NEW
MESSAGE=See BOA-NBU-1. Partial success. See BOA-NBU-2. Network problems. See BOA-NBU-7. Backup aborted. See BOA-NBU-8. None of the files to backup exist. See BOA-NBU-12. No usable tapes found for catalog backup. See BOA-NBU-13. Backup window closed. See BOA-NBU-14. Storage unit is unavailable.

King Regards

Junes


Report Offensive Message For Removal


Response Number 1
Name: Devaraj (by Fidy)
Date: November 12, 2006 at 21:03:22 Pacific
Subject: Awk Help
Reply: (edit)
If you want to print only the lines which contains ^1$ , the you may want to dosomething like this..

awk '{if ($2=="^1$") print $0} ' input
or to look for all the partial sucesses

sed -n '/Partial success/p' input

Hope this helps.

-Devaraj Takhellambam

Regards,
Devaraj Takhellambam


Report Offensive Follow Up For Removal




Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: Awk Help

Comments:

 
  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 


Data Recovery Software




XP Installed to G?

exessive internet traffic

ZoneAlarm Question. Blocked Connect

Windows Live Messenger Problem

Delete $Uninstall after SP3 updates


The information on Computing.Net is the opinions of its users. Such opinions may not be accurate and they are to be used at your own risk. Computing.Net cannot verify the validity of the statements made on this site. Computing.Net and Computing.Net, LLC hereby disclaim all responsibility and liability for the content of Computing.Net and its accuracy.
PLEASE READ THE FULL DISCLAIMER AND LEGAL TERMS BY CLICKING HERE

All content ©1996-2007 Computing.Net, LLC