Sponsored Content
Top Forums Shell Programming and Scripting Using awk or nawk to convert epoch time to date format Post 302568523 by minigts on Thursday 27th of October 2011 12:49:34 PM
Old 10-27-2011
Gotcha. The least common denominator is what we have to go by and some of the Solaris machines do not have Perl installed. Not sure if this company policy or what, but that is the limiting factor.

That's a good point though. I'll update my original post to reflect this limitation.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to convert epoch time to readible format?

Hi, I would like to convert epoch time from the logs to readible fromat. How do I do it within shell? Thanks! (11 Replies)
Discussion started by: cin2000
11 Replies

2. Shell Programming and Scripting

Convert Epoch time format to normal date time format in the same file

I have a file named "suspected" with series of line like these : {'protocol': 17, 'service': 'BitTorrent KRPC', 'server': '219.78.120.166', 'client_port': 52044, 'client': '10.64.68.44', 'server_port': 8291, 'time': 1226506312L, 'serverhostname': ''} {'protocol': 17, 'service': 'BitTorrent... (3 Replies)
Discussion started by: rk4k
3 Replies

3. Shell Programming and Scripting

Convert Epoch Time to Standard Date and Time & Vice Versa

Hi guys, I know that this topic has been discuss numerous times, and I have search the net and this forum for it. However, non able to address the problem I faced so far. I am on Solaris Platform and unable to install additional packages like the GNU date and gawk to make use of their... (5 Replies)
Discussion started by: DrivesMeCrazy
5 Replies

4. Shell Programming and Scripting

how to convert date time to epoch time in solaris

Hi, Is there any easy way to convert date time(stored in shell variable ) to epoch time in solaris box? As +%s is working on linux but not on solaris, also -d option is not working. Any suggestion please? (6 Replies)
Discussion started by: anshuman0507
6 Replies

5. Shell Programming and Scripting

Need to convert an epoch date to MMDDYYHHmm format

System: HP-UX Kornshell Perl is installed, but not POSIX Hello, I am calculating a future date/time. To do this I take the system date in epoch format and add to it. I now need to take the new epoch date and convert it to MMDDYYHHmm format. Any help with this is greatly appreciated. (4 Replies)
Discussion started by: LetsGoPens
4 Replies

6. Shell Programming and Scripting

Convert epoch to human readable date & time format

Hello I have log file from solaris system which has date field converted by Java application using System.currentTimeMillis() function, example is 1280943608380 which equivalent to GMT: Wed, 04 Aug 2010 17:40:08 GMT. Now I need a function in shell script which will convert 1280943608380... (3 Replies)
Discussion started by: Yaminib
3 Replies

7. Shell Programming and Scripting

Convert epoch time to Julian date

Need assistance in converting an epoch time to Julian date To get epoch perl -e 'use Time::Local; print timelocal(1,5,2,12,10,2008), "\n"' (3 Replies)
Discussion started by: ajayram_arya
3 Replies

8. Shell Programming and Scripting

Convert epoch time stamp into human readable format

Can someone help me to write a shell script to convert epoch timestamp into human readable format 1394553600,"test","79799776.0","19073982.728571","77547576.0","18835699.285714" 1394553600,"test1","80156064.0","19191275.014286","62475360.000000","14200554.720000"... (10 Replies)
Discussion started by: Moon1234
10 Replies

9. Shell Programming and Scripting

Convert Second Column Date Into EPOCH Time And Print Complete Row

Hello Team, I am stuck in getting the required output in the following case. Please help. My input file is aa|08/01/2016 bb|08/15/2016 I wish to convert the file into aa|epoch time bb|epoch time I am using following code: (3 Replies)
Discussion started by: angshuman
3 Replies

10. UNIX for Beginners Questions & Answers

Date format conversion how to change this from using nawk to awk

Hi, I have a file where I need to change the date format on the nth field from DD-MM-YYYY to YYYY-MM-DD so I can accurately sort the record by dates From regex - Use sed or awk to fix date format - Stack Overflow, I found an example using nawk. Test run as below: $: cat xyz.txt A ... (2 Replies)
Discussion started by: newbie_01
2 Replies
STRPCT(3)						   BSD Library Functions Manual 						 STRPCT(3)

NAME
strpct, strspct -- decimal percent formatters LIBRARY
System Utilities Library (libutil, -lutil) SYNOPSIS
#include <util.h> char * strpct(char *buf, size_t bufsiz, uintmax_t numerator, uintmax_t denominator, size_t precision); char * strspct(char *buf, size_t bufsiz, intmax_t numerator, intmax_t denominator, size_t precision); DESCRIPTION
The strpct() function formats the fraction represented by numerator and denominator into a percentage representation with given number of digits of precision without using floating point arithmetic. RETURN VALUES
strpct() and strspct() always return a pointer to a NUL-terminated (unless buflen is 0) formatted string which is placed in buf and is up to buflen characters. If there was an overflow, the formatted string will reflect that precision loss. EXAMPLES
strpct(buf, buflen, 1, 16, 3); => "6.250" strpct(buf, buflen, 1, 2, 0); => "50" HISTORY
strpct() was originally implemented in csh(1) for NetBSD 1.3. It printed into a static buffer, was not locale aware, handled unsigned long numbers, and printed a ``%'' at the end of the number. Other programs such as df(1) and time(1) started using it. strpct() and strspct() appeared separately in libutil for NetBSD 6.0. AUTHORS
Erik E. Fair <fair@netbsd.org> BSD
January 7, 2012 BSD
All times are GMT -4. The time now is 04:41 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy