06-08-2012
Scripting issue
Hi experts...
I am really new to this scripting, i really need your help.
I have this script to read and print the report, however the script does not pickup the correct hostname (eg. Svtns11d)..
The script will start reading/pick up on the second line instead of reading the first line. Reason why it does not display the hostname "Svtns11d".
MESSAGE: ANE7897I Starting backup of host Machine 'Svtns11d'
mode=Full, target node name='SVTTHB_BBK', data mover node
Really need your help... Attached below is the script
Script:
...
....
{
if ( $1 ~ /MESSAGE:/ && $2 ~ /7897/ )
{
NEXT_LINE=0; MSGNO=7897;
if ( FIRST == 0 )
FIRST=1;
else
{
LNCNT=LNCNT+1;
printf("%2d %-10s %8d %10d %8d %8d %8d %7d %-12s %-10s\n", LNCNT, HOSTNAME, INSPECTED, BACKUP, UPDATED, DELETED, EXPIRED, FAILED, XFER, ELAPSED);
HOSTNAME=" "; INSPECTED=0; BACKUP=0; UPDATED=0; DELETED=0; EXPIRED=0; FAILED=0; XFER=0; ELAPSED=0;
}
}
else
if ( $1 ~ /MESSAGE:/ && $2 ~ /7888/ )
INSPECTED=$8;
else
if ( $1 ~ /MESSAGE:/ && $2 ~ /7889/ )
BACKUP=$9;
else
if ( $1 ~ /MESSAGE:/ && $2 ~ /7891/ )
UPDATED=$8;
else
if ( $1 ~ /MESSAGE:/ && $2 ~ /7892/ )
DELETED=$8;
else
if ( $1 ~ /MESSAGE:/ && $2 ~ /7893/ )
EXPIRED=$8;
else
if ( $1 ~ /MESSAGE:/ && $2 ~ /7894/ )
FAILED=$8;
else
if ( $1 ~ /MESSAGE:/ && $2 ~ /7895/ )
XFER=sprintf("%s %s", $8, $9);
else
if ( $1 ~ /MESSAGE:/ && $2 ~ /7896/ )
ELAPSED=$6
else
if ( NEXT_LINE == 0 && MSGNO ~ /7897/ )
{ HOSTNAME=substr($7,2,8); NEXT_LINE=0; MSGNO=0; }
}
END {
LNCNT=LNCNT+1;
printf("%2d %-10s %8d %10d %8d %8d %8d %7d %-12s %-10s\n\n", LNCNT, HOSTNAME, INSPECTED, BACKUP, UPDATED, DELETED, EXPIRED, FAILED, XFER, ELAPSED);
}
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
folks;
i'm trying to write a shell script to do the following:
1. i have a file with 39 fields, i'm trying to add 10 more fields with (!) as a field separator. with the following requirement:
if field number 20 has a value, then field number 40 will show as (!M!), and if the field number 20 does... (2 Replies)
Discussion started by: moe2266
2 Replies
2. Shell Programming and Scripting
Hi guys...
I am a newbie to scripting... I have a small requirement... I dont whether u r clear with my requirement... But plz try to help me...
Like,
tell me some kind of scripts that can help me in retreiving the data from the datasets.
Regards,
Mahesh... (1 Reply)
Discussion started by: mraghunandanan
1 Replies
3. Shell Programming and Scripting
Hi guys...
I am newbie to Shell Scripting...
I am querying the Oracle database.I want a Shell script for fetching some data from datasets in Oracle database and displaying in an excel sheet.This is my requirement..
Can u plz help me guys..
Regards,
Mahesh... (4 Replies)
Discussion started by: mraghunandanan
4 Replies
4. Shell Programming and Scripting
Hi Guys,
I am quite new to Shell Scripting... I need ur help.. This is very urgent.
The thing is like,
I need to match a IP address (ex 192.168.200.56) i.e, xxx.xxx.xxx.xx inside a KSH script,but if we enter in different format other than the specified format (ex jjj.ksj., 1.0...), it should... (3 Replies)
Discussion started by: mraghunandanan
3 Replies
5. Shell Programming and Scripting
Hello,
Guys I am having a sql script file which contains some sql statements including inserting values, One column is of the data type date.
Now i am having a KSH script for inserting values via this script into the database.
The problem I am facing that when I am inserting value in the... (1 Reply)
Discussion started by: mraghunandanan
1 Replies
6. Shell Programming and Scripting
Hello,
I have an ASCII file (many files of the same format, but different dates and numbers) in the format like below:
2008.01.02,08:00,1.46520,1.46520,1.46410,1.46440,70
2008.01.02,08:05,1.46450,1.46560,1.46440,1.46540,79
2008.01.02,08:10,1.46530,1.46540,1.46490,1.46500,46... (8 Replies)
Discussion started by: chief2000
8 Replies
7. Shell Programming and Scripting
I am having an issue with a script that I created today, my first attempt at this, and was wondering if anyone can give me insight to what changes need to be made. Below is a copy of the script that I have written. WEe are trying to monitor whether or not a services is running. I do have a cron... (1 Reply)
Discussion started by: lsudubee
1 Replies
8. Shell Programming and Scripting
needing this script to shut down 1 IceS and start up another, close the 2nd one after 12 seconds and then reboot. here is what i have so far
#!/bin/bash
ShutDown() {
echo "Shutdown in progress."
wall <<ENDOFWALL
CI Shutdown has been intiated!!!!
Shutdown will occur in 30 seconds...... (1 Reply)
Discussion started by: Zaine
1 Replies
9. Shell Programming and Scripting
I am having a problem. which I have described below>>
I have to run a script with the format : <File_name><Start_date><End_date>
abcd.sh 19-JAN-2015 01-May-2014
problem is I need to compare these two dates and throw an error as start date must be less than or equal to end date.
But... (13 Replies)
Discussion started by: Chandan_Bose
13 Replies
10. Shell Programming and Scripting
Hi Experts,
I'm stuck with a single liner bash script. Need your help to fix it.
Let me brief you that what is my expectations from this script.
I need the interfaces configured for a list of servers, their respective IP address and FQDN in a output file. The output should be in the same... (3 Replies)
Discussion started by: arun_adm
3 Replies
LEARN ABOUT MINIX
truncate
TRUNCATE(1) User Commands TRUNCATE(1)
NAME
truncate - shrink or extend the size of a file to the specified size
SYNOPSIS
truncate OPTION... FILE...
DESCRIPTION
Shrink or extend the size of each FILE to the specified size
A FILE argument that does not exist is created.
If a FILE is larger than the specified size, the extra data is lost. If a FILE is shorter, it is extended and the extended part (hole)
reads as zero bytes.
Mandatory arguments to long options are mandatory for short options too.
-c, --no-create
do not create any files
-o, --io-blocks
treat SIZE as number of IO blocks instead of bytes
-r, --reference=RFILE
base size on RFILE
-s, --size=SIZE
set or adjust the file size by SIZE bytes
--help display this help and exit
--version
output version information and exit
The SIZE argument is an integer and optional unit (example: 10K is 10*1024). Units are K,M,G,T,P,E,Z,Y (powers of 1024) or KB,MB,... (pow-
ers of 1000).
SIZE may also be prefixed by one of the following modifying characters: '+' extend by, '-' reduce by, '<' at most, '>' at least, '/' round
down to multiple of, '%' round up to multiple of.
AUTHOR
Written by Padraig Brady.
REPORTING BUGS
GNU coreutils online help: <http://www.gnu.org/software/coreutils/>
Report truncate translation bugs to <http://translationproject.org/team/>
COPYRIGHT
Copyright (C) 2017 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.
SEE ALSO
dd(1), truncate(2), ftruncate(2)
Full documentation at: <http://www.gnu.org/software/coreutils/truncate>
or available locally via: info '(coreutils) truncate invocation'
GNU coreutils 8.28 January 2018 TRUNCATE(1)