I have the following awk script which works well for the most part, but when the first field, client, contains client.domain.com, I would just like to display the client portion. I would also like to modify the elapsed time so that it does not display leading zero's (if hhh:mm:ss is equal to 000:04:23 I would only like to display m:ss). Sample output and desired output are shown below.
BEGIN {printf ("%-25s %-9s %-l6s %12s %-11s %-10s\n" ,
"Client", "Date", "Time", "Elapsed Time", "Total MB", "# of Files"print "==============================================================================="}
/^Client:/{client = $2}
/^Backup Time:/{date = $3; time = $4}
/^Elapsed Time:/{elapsed = $3}
/^Kilobytes:/{$2=$2/1024; MB = $2}
/^Number of Files:/{files = $4; printf ("%-25s %-9s %-6s %-12s %-11.0f %-10s\n", client, date, time, elapsed, MB, files)}
Sample Output:
Client Date Time Elapsed Time Total MB # of Files
====================================================================
client.dom.com 09/08/2003 05:12:27 000:04:29 62 60
client2.dom.com 09/07/2003 08:17:07 023:04:29 462 600
Desired Output:
Client Date Time Elapsed Time Total MB # of Files
============================================================
client 09/08/2003 05:12:27 04:29 62 60
client2 09/08/2003 08:17:07 23:04:29 462 600
Any help would be greatly appreciated.
Thanks,
John
BEGIN {printf ("%-25s %-9s %-l6s %12s %-11s %-10s\n" ,
"Client", "Date", "Time", "Elapsed Time", "Total MB", "# of Files"print "==============================================================================="}
/^Client:/{client = $2}
/^Backup Time:/{date = $3; time = $4}
/^Elapsed Time:/{elapsed = $3}
/^Kilobytes:/{$2=$2/1024; MB = $2}
/^Number of Files:/{files = $4; printf ("%-25s %-9s %-6s %-12s %-11.0f %-10s\n", client, date, time, elapsed, MB, files)}
Sample Output:
Client Date Time Elapsed Time Total MB # of Files
====================================================================
client.dom.com 09/08/2003 05:12:27 000:04:29 62 60
client2.dom.com 09/07/2003 08:17:07 023:04:29 462 600
Desired Output:
Client Date Time Elapsed Time Total MB # of Files
============================================================
client 09/08/2003 05:12:27 04:29 62 60
client2 09/08/2003 08:17:07 23:04:29 462 600
Any help would be greatly appreciated.
Thanks,
John