![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| epoch time | ali560045 | Shell Programming and Scripting | 3 | 06-02-2008 01:41 AM |
| script to convert epoch into human-readable | snoman1 | Shell Programming and Scripting | 3 | 04-18-2008 12:59 PM |
| Epoch time | 12yearold | UNIX for Advanced & Expert Users | 2 | 07-14-2006 12:11 PM |
| Epoch time | 12yearold | Shell Programming and Scripting | 1 | 07-14-2006 08:57 AM |
| Convert from standard epoch time from a shell script? | LordJezo | Shell Programming and Scripting | 4 | 09-18-2005 08:48 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi,
I would like to convert epoch time from the logs to readible fromat. How do I do it within shell? Thanks! |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
what OS are you on?
|
|
#3
|
|||
|
|||
|
what OS are you on?
what's the command to do it?
|
|
#4
|
|||
|
|||
|
OS config
ok.
Here it is: System Configuration: Sun Microsystems sun4u Memory size: 512 Megabytes |
|
#5
|
|||
|
|||
|
Aim this module at your perl ie., #!/path/to/your/perl
Code:
#!/usr/bin/perl
# date from time_t seconds since the start of epoch then.pl
$then = localtime($ARGV[0]);
print("$then\n");
Code:
logdate=`then.pl <time since start of epoch>` echo "$logdate" |
|
#6
|
||||
|
||||
|
Code:
#!/bin/ksh
# here's my current EPOCH time
currentEpoch=$(/usr/bin/truss /usr/bin/date 2>&1 | /usr/bin/awk '/^time/ {print $NF}')
# here we convert EPOCH back to human readable format
back2Human=$(echo "0t${currentEpoch}=Y" | /usr/bin/adb)
echo "date->[$(date)] currentEpoch->[${currentEpoch}] back2Human->[${back2Human}]"
|
|
#7
|
||||
|
||||
|
cin2000, "uname -a" will tell you the os.
vger99, I like that procedure to to get the internal time. I'll never use it, mind you. But I like it anyway. Between the 32/64 bit confusion and the user permission problems, I have started using perl for this stuff: perl -e 'print time, "\n"'. |
||||
| Google The UNIX and Linux Forums |