Hi,
Below is my code which the output I receive is not what I expect. What I need help in is when
/[a-z]:/ is not found print a mesg and then exit or else if pattern is found, print certain columns as required.
awk '{if(!~/:/){
print "No Errors were Found for `date +'%Y%m%d'`"
}
else
{
printf "%s %s\n", $1,$2
}
}' file > output filename
sample file
APAU_DATETIME APAU_USER_NAME APAU_EXTRAINFO
-------------------------- ------------------------------ ---------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------------
Jul 11 2005 7:19AM Jack rrr:05 Correct: 2
(1 row affected)
and
APAU_DATETIME APAU_USER_NAME APAU_EXTRAINFO
-------------------------- ------------------------------ ---------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------------
(0 row affected)
Many Thanks
Chris
Below is my code which the output I receive is not what I expect. What I need help in is when
/[a-z]:/ is not found print a mesg and then exit or else if pattern is found, print certain columns as required.
awk '{if(!~/:/){
print "No Errors were Found for `date +'%Y%m%d'`"
}
else
{
printf "%s %s\n", $1,$2
}
}' file > output filename
sample file
APAU_DATETIME APAU_USER_NAME APAU_EXTRAINFO
-------------------------- ------------------------------ ---------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------------
Jul 11 2005 7:19AM Jack rrr:05 Correct: 2
(1 row affected)
and
APAU_DATETIME APAU_USER_NAME APAU_EXTRAINFO
-------------------------- ------------------------------ ---------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------------
(0 row affected)
Many Thanks
Chris