Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

convert microseconds into hours munites and seconds using awk.

Posted on 2008-06-16
3
Medium Priority
?
1,360 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 85

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 85

Accepted Solution

by:
ozo earned 2000 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

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Question has a verified solution.

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

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

877 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