Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Outputting Data To DOS

Status
Not open for further replies.

calabrra

Technical User
Sep 16, 2003
14
US
I would like to compute elapsed time (hh:mm:ss) in my AWK routine and display it on the DOS console window.

Is there a simple way to do this?


Thanks,
-Bob
 
Here's something that may get you started. I assume you are running awk under windows since you mention a DOS window, and this solution relies on the unix date command. You can get it by installing cygwin. I renamed it udate because it is later in my path than the dos date function.

BEGIN{
dat = "udate +%T"
dat | getline
close(dat)
split($0,a,":")
secs = a[1]*3600 + a[2]*60 + a[3]
# print a[1],a[2],a[3],secs
}
{
# <your program>
}
END {
dat | getline
close(dat)
split($0,a,&quot;:&quot;)
# print a[1],a[2],a[3]
print &quot;Elapsed time = &quot; a[1]*3600 + a[2]*60 + a[3] - secs
}

CaKiwi

&quot;I love mankind, it's people I can't stand&quot; - Linus Van Pelt
 
I'm running Win2K Pro on a laptop. I'll give CaKiwi's suggestion a try.

Thanks,
-Bob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top