christiniaroelin
Programmer
Hi all,
I have the following code:
awk ' { str[NR] = $0 } END {
if ( ( $0 ~ / files found/) && ( $2< '$min_file'))
{
print $2 " files found : WARNING : EXPECTED MINIMUM NUMBER OF FILES " "'"$min_file"'" "\n\n"
print NR
for ( i=NR; i>(NR-5) ; i-- )
print str
}
if ( ( $0 ~ / *usr /) && ( $3 < 9)) {
print $0 "\n WARNING : HEADER NLOD FOUND FOR THE ABOVE LISTING HAVING ONLY : " $3 " BYTES \n\n"
}
}' < outnlod.dat
Im trying to print the previous 5 lines from -files found- record and which meets the criteria of min files found.It all worked fine until i added the for statement to print the previous 5 lines that meets the 'if' criteria.
Please let me know what im missing. I'm a beginner and learning awk by experimenting with examples as above. Your help in my awk pursuit is much appreciated.
Thanks again
Roelin
I have the following code:
awk ' { str[NR] = $0 } END {
if ( ( $0 ~ / files found/) && ( $2< '$min_file'))
{
print $2 " files found : WARNING : EXPECTED MINIMUM NUMBER OF FILES " "'"$min_file"'" "\n\n"
print NR
for ( i=NR; i>(NR-5) ; i-- )
print str
}
if ( ( $0 ~ / *usr /) && ( $3 < 9)) {
print $0 "\n WARNING : HEADER NLOD FOUND FOR THE ABOVE LISTING HAVING ONLY : " $3 " BYTES \n\n"
}
}' < outnlod.dat
Im trying to print the previous 5 lines from -files found- record and which meets the criteria of min files found.It all worked fine until i added the for statement to print the previous 5 lines that meets the 'if' criteria.
Please let me know what im missing. I'm a beginner and learning awk by experimenting with examples as above. Your help in my awk pursuit is much appreciated.
Thanks again
Roelin