Sponsored Content
Top Forums Shell Programming and Scripting Convert epoch time stamp into human readable format Post 302892415 by linuxpenguin on Wednesday 12th of March 2014 02:41:48 PM
Old 03-12-2014
try this

Code:
while read line;do
  ts=`echo "$line"|cut -f1
  rest=`echo "$line"|cut -f2-
  d=`date --date="@${ts}"
  echo "$d,$rest"
done < inputfile > output file


Last edited by Don Cragun; 03-12-2014 at 03:55 PM.. Reason: Fix CODE tags.
 

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

script to convert epoch into human-readable

This is what I have to start out with more file 1208217600 1208131200 1193806800 I want to convert the epoch column into a human-readable format. My file has hundreds of these epoch times that I want to loop through and convert. (The epoch time is really the last column of the line) ... (3 Replies)
Discussion started by: snoman1
3 Replies

3. 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

4. UNIX for Dummies Questions & Answers

How to make user's qutoa in human readable format?

$ quota Disk quotas for user cqlouis (uid 1254): Filesystem blocks quota limit grace files quota limit grace /dev/sdb1 64 300000 320000 8 0 0 $ I want to make the output of command quota in human readable format? How to? As we... (2 Replies)
Discussion started by: cqlouis
2 Replies

5. 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

6. Shell Programming and Scripting

How to get time duration between two human readable time stamp in Unix?

Here is two time I have: Jul 12 16:02:01 Jul 13 01:02:01 and how can I do a simple match to get difference between two time which is 09:00:00 Thanks in advance. (3 Replies)
Discussion started by: ford99
3 Replies

7. Shell Programming and Scripting

Using awk or nawk to convert epoch time to date format

Looking for some help and usually when I do a search this site comes up. Hopefully someone can give me a little direction as to how to use one of these two commands to achieve what I'm trying to do. What am I trying to do? I need to take the time value in epoch format returned from the... (5 Replies)
Discussion started by: minigts
5 Replies

8. UNIX for Dummies Questions & Answers

Display Directories with their sizes in human readable format

Hi, I want to list all the directories present in a particular location and want to display their sizes as well. I know "ls -lh" but it doesn't show the size of the complete directory. So i want something like dir1 266 MB dir2 2 KB dir3 22 MB ... ... file1 10 Kb ..... Thanks Sarbjit (4 Replies)
Discussion started by: sarbjit
4 Replies

9. Shell Programming and Scripting

Multiple records need to convert UNIXtime to human readable datatime and all output in one format

Hello Experts, Below is the record i have: sample data attached I want this record of each row to be in single line and there are multiple rowise unixtime mentioned e.g 11996327 , This needs to be converted to Human readdable data and time from multiple rows Can you help me , it will be... (10 Replies)
Discussion started by: manishK
10 Replies

10. Shell Programming and Scripting

Converting a random epoch time into a readable format

I am trying to create a script that will take epoch (input from command line) and convert it into a readable format in bash/shell ---------- Post updated at 08:03 PM ---------- Previous update was at 07:59 PM ---------- #!bin/bash read -p "Please enter a number to represent epoch time:"... (9 Replies)
Discussion started by: sprocket
9 Replies
PLUTIL(1)						    BSD General Commands Manual 						 PLUTIL(1)

NAME
plutil -- property list utility SYNOPSIS
plutil [command_option] [other_options] file ... DESCRIPTION
plutil can be used to check the syntax of property list files, or convert a plist file from one format to another. Specifying - as an input file reads from stdin. The first argument indicates the operation to perform, one of: -help Show the usage information for the command and exit. -p Print the property list in a human-readable fashion. The output format is not stable and not designed for machine parsing. The purpose of this command is to be able to easily read the contents of a plist file, no matter what format it is in. -lint Check the named property list files for syntax errors. This is the default command option if none is specified. -convert fmt Convert the named file to the indicated format and write back to the file system. If the file can't be loaded due to invalid syntax, the operation fails. fmt is one of: xml1, for version 1 of the XML plist format binary1, for version 1 of the binary plist format json, for the JSON format There are a few additional options: -- Specifies that all further arguments are file names -s Don't print anything on success. -r For JSON, add whitespace and indentation to make the output more human-readable. -o path Specify an alternate path name for the result of the -convert operation; this option is only useful with a single file to be converted. Specifying - as the path outputs to stdout. -e extension Specify an alternate extension for converted files, and the output file names are otherwise the same. DIAGNOSTICS
The plutil command exits 0 on success, and 1 on failure. SEE ALSO
plist(5) STANDARDS
The plutil command obeys no one's rules but its own. HISTORY
The plutil command first appeared in Mac OS X 10.2. Mac OS X August 30, 2002 Mac OS X
All times are GMT -4. The time now is 05:36 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy