Solved

convert microseconds into hours munites and seconds using awk.

Posted on 2008-06-16
3
1,304 Views
Last Modified: 2013-12-26
how can i convert a long int value(time in microseconds) into hours munites and seconds using awk.
0
Comment
Question by:techass
  • 2
3 Comments
 
LVL 84

Expert Comment

by:ozo
ID: 21798102
awk '{printf"%02d:%02d:%02d\n",$1/3600000000,$1/60000000%60,$1/1000000%60}'
0
 

Author Comment

by:techass
ID: 21803379
yes but if also I could convert the time in mks into hh:mm:ss.ms (where ms is miliseconds ). Also I need to print other columns too. $2, $3.. so on.
0
 
LVL 84

Accepted Solution

by:
ozo earned 500 total points
ID: 21804023
awk '{$1=sprintf("%02d:%02d:%02d.%03d",$1/3600000000,$1/60000000%60,$1/1000000%60,$1/1000%1000); print}'

0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used.

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question