Solved

convert microseconds into hours munites and seconds using awk.

Posted on 2008-06-16
3
1,302 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Linux Hanging with disable Error Output 4 86
Line meaning 9 87
Message not shown 5 51
awk sed 8 45
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…
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.

831 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