I am a complete novice with AWK and would like to use it to extract and summarize information from a Backup Exec logfile.
I have managed the basics of extracting the raw info I want -
awk "/Job name/ { print $0 } " bex182.txt
awk "/Processed/ { print $0 } " bex182.txt
awk "/Job completion status/ { print $0} " bex182.txt
which does show all the information I want -
Job name: BNLS250a Normals
Processed 1,682,728,387 bytes in 1 hour, 33 minutes, and 13 seconds.
Processed 649,662,003 bytes in 32 minutes and 58 seconds.
Processed 97,028 bytes in 9 seconds.
Processed 111,165,992 bytes in 3 minutes and 43 seconds.
Processed 3,691,683,926 bytes in 5 hours, 51 minutes, and 29 seconds.
Job completion status: Failed
I wish to ideally format the output of the information into
columns like so -
JOB NAME BYTE COUNT STATUS
BNLS250a Normals <SUM OF ALL BYTES> FAILED
I have tried to calculate the sum of btyes processed -
awk "/Processed/ {bytes += $2} END {print bytes}" bex182.txt
which is giving me a total of 861 (seems to be adding only the figures before the first "," in number i.e. 1, 649, 97, 111, 3. How can I add the whole amount?
How can I tie this altogether to output the data, in the format I want, and with the correct calculations?
Can anybody help?
By the way - I am using AWK95 on DOS /WIndows2000 so perhaps that's why some of the syntax " etc may look a bit different.
Thanks
I have managed the basics of extracting the raw info I want -
awk "/Job name/ { print $0 } " bex182.txt
awk "/Processed/ { print $0 } " bex182.txt
awk "/Job completion status/ { print $0} " bex182.txt
which does show all the information I want -
Job name: BNLS250a Normals
Processed 1,682,728,387 bytes in 1 hour, 33 minutes, and 13 seconds.
Processed 649,662,003 bytes in 32 minutes and 58 seconds.
Processed 97,028 bytes in 9 seconds.
Processed 111,165,992 bytes in 3 minutes and 43 seconds.
Processed 3,691,683,926 bytes in 5 hours, 51 minutes, and 29 seconds.
Job completion status: Failed
I wish to ideally format the output of the information into
columns like so -
JOB NAME BYTE COUNT STATUS
BNLS250a Normals <SUM OF ALL BYTES> FAILED
I have tried to calculate the sum of btyes processed -
awk "/Processed/ {bytes += $2} END {print bytes}" bex182.txt
which is giving me a total of 861 (seems to be adding only the figures before the first "," in number i.e. 1, 649, 97, 111, 3. How can I add the whole amount?
How can I tie this altogether to output the data, in the format I want, and with the correct calculations?
Can anybody help?
By the way - I am using AWK95 on DOS /WIndows2000 so perhaps that's why some of the syntax " etc may look a bit different.
Thanks