This script has 2 funtions. i will post the first part of the code.
Code:
#! /usr/bin/ksh
# This script goes through failure logs and prints out a useful
# synopsis of the last failure
# It relies on test log files, console logs, and autotest.result.
. lib.ksh
if [ _$1 = _-all ] ; then
all=1
fi
failures=/tmp/failures.tmp
failLines=/tmp/failLines.tmp
utilFailLines=/tmp/utilFailLines.tmp
miscompareLines=/tmp/miscompareLines.tmp
con=/tmp/con.tmp
failInfo=/tmp/failInfo.tmp
function analyzeConsole
{
# First, cut the console data down to just the part that printed
# out during that test.
# Then run it through termReport.pl.
# Then get the interesting parts of that.
#################################################
# Reading from globallyIgnoredTc list and setting up an array & converting upper case to lower case
file=../data/globallyIgnoredTc.dat
set -A ignore `grep -v "#" ${file} | tr '[A-Z]' '[a-z]' `
#################################################
endMarker="NSC Termination Event Details:"
if [ ! -f $4 ] ; then
echo "No $4 file found. Perhaps testMgr is still running?"
else
# Subtract out a little from the start time. Otherwise we miss
# crashes because of the controller clocks being off by a few seconds.
#dateFilter $4 $(( $2 - 10 )) $3 > $con
# BGL -- analyze all of the consoles. Autotest does the trimming now.
termReport.pl < $4 | dos2ux | head -2000 | awk '
BEGIN { foundTermEvent=0;
endMarker="'"${endMarker}"'"; }
{
if ( (substr($0, 1, length(endMarker)) == endMarker) ||
(substr($0, 1, 39) == "'${SBINDIR}'/termReport.pl: ") )
{
if (foundTermEvent == 1)
{
print "";
foundTermEvent=0;
}
}
##############################################################################
if (foundTermEvent == 1)
{
z=0
while [[ $z -lt ${#ignore[*]} ]] ; do
if [[ ${ignore[$z]} == "$1" ]] #I want all my array elements to compair against $1. If $1 match with ANY array element, condition is true.
then
print " FOUND A BADTC FROM THE LIST "
foundTermEvent = 0;
print " Z= $z "
echo " ignore[$z] = ${ignore[$z]}"
let z=$z+1
else
#print;
print " DIDNT FIND ANY BAD TCs "
print " Z= $z "
let z=$z+1
fi
done
}
####################################################################
if (substr($0, 1, 18) == "Termination Event:")
{
foundTermEvent=1;
}
}'
fi
}
function analyzeFailure
{
---------- Post updated at 07:14 PM ---------- Previous update was at 07:11 PM ----------
part i get an error is last while loop and the if statement in the while loop. it is complaining about AWK syntax not being correct.
Hi,
I made a small awk program just to test array variables.
I couldn't find anything wrong with it.
But it doesn't give out valid numbers.( just 0.00 )
Do you see any problem that I didn't see?
Thanks in advance!
Here is the program:
##################################
BEGIN {
FS =... (4 Replies)
Hi,
I have this script:
awk -v va=45 '$0~va{print}' flo2
That returns: "4526745 1234 " (this is the only line of the file "flo2".
However, I would like to get "va" to match the begining of the line, so that is "va" is different than 45 (eg. 67, 12 ...) I would not have any output. That... (3 Replies)
i have an array call ignore. it is set up
ignore=34th56
ignore=re45ty
ignore=rt45yu
.
.
ignore=rthg34
n is a variable. I have another variable that i read from a different file. It is $2 and it is working the way i expect. array ignore read and print correct values.
in the below if... (2 Replies)
i have a file like this
< '393200103052';'H3G';'20081204'
< '393200103059';'TIM';'20110111'
< '393200103061';'TIM';'20060206'
< '393200103064';'OPI';'20110623'
> '393200103052';'HKG';'20081204'
> '393200103056';'TIM';'20110111'
> '393200103088';'TIM';'20060206'
Now i have to generate a file... (9 Replies)
Hi
Could anyone please help with Awk.
The below code prints the PID of the matching process with condition with $8 and $9
ps -ef |awk '($8~/proc/) && ($9~/rPROC2/) {print $2}'
Now i want to change the Constant PROC2 from Shell variable
PROC2 is already declared in shell variable SRVNAME... (9 Replies)
Hello,
I am trying to redirect files to a directory by using a config file. The config files is as such:
xxxxxx,ID,PathToDirectory
xxxxxx,ID2,PathToDirectory2
and so on...
I have a variable that should match one of these IDs. I want to load this config file into an awk array, and... (2 Replies)
Hello experts,
I'm stuck with this script for three days now. Here's what i need.
I need to split a large delimited (,) file into 2 files based on the value present in the last field.
Samp: Something.csv
bca,adc,asdf,123,12C
bca,adc,asdf,123,13C
def,adc,asdf,123,12A
I need this split... (6 Replies)
Hi
my data is in csv-format ...
...
13/08/2012,16:30,303.30,5.10,3,2,2,1,9360.0,322
13/08/2012,16:40,305.50,5.00,3,2,2,1,12360.0,322
13/08/2012,16:50,319.90,3.80,3,2,1,0,2280.0
13/08/2012,17:00,326.10,3.50,3,2,1,1,4380.0,321
13/08/2012,17:10,333.00,3.80,3,3,1,0,2280.0... (1 Reply)
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
my data in csv-format ...
...
13/08/2012,16:30,303.30,5.10,3,2,2,1,9360.0,322... (13 Replies)
Hi Guys,
I wanted to compare a delimited file and positional file, for a particular key files and if it matches then append the positional file with some data.
Example:
Delimited File
--------------
Byer;Amy;NONE1;A5218257;E5218257
Byer;Amy;NONE1;A5218260;E5218260
Positional File... (3 Replies)
Discussion started by: Ajay Venkatesan
3 Replies
LEARN ABOUT OPENSOLARIS
igawk
IGAWK(1) Utility Commands IGAWK(1)NAME
igawk - gawk with include files
SYNOPSIS
igawk [ all gawk options ] -f program-file [ -- ] file ...
igawk [ all gawk options ] [ -- ] program-text file ...
DESCRIPTION
Igawk is a simple shell script that adds the ability to have ``include files'' to gawk(1).
AWK programs for igawk are the same as for gawk, except that, in addition, you may have lines like
@include getopt.awk
in your program to include the file getopt.awk from either the current directory or one of the other directories in the search path.
OPTIONS
See gawk(1) for a full description of the AWK language and the options that gawk supports.
EXAMPLES
cat << EOF > test.awk
@include getopt.awk
BEGIN {
while (getopt(ARGC, ARGV, "am:q") != -1)
...
}
EOF
igawk -f test.awk
SEE ALSO gawk(1)
Effective AWK Programming, Edition 1.0, published by the Free Software Foundation, 1995.
AUTHOR
Arnold Robbins (arnold@skeeve.com).
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+--------------------+-----------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+--------------------+-----------------+
|Availability | SUNWgawk |
+--------------------+-----------------+
|Interface Stability | Volatile |
+--------------------+-----------------+
NOTES
Source for gawk is available on http://opensolaris.org.
Free Software Foundation Nov 3 1999 IGAWK(1)