Programming :: Converting Epoch In A File Name To Human Readable Date/time?
May 5, 2011
I have log files that everyday are downloaded from my webserver in the format: Code: samplesite.com.xxxxxxxxxxx.gz xxxxxxxxxx is a 10 digit epoch time. I am trying to figure out a way in batch to:
1. find all of exisiting files containing the pattern (after the first run it will only be one a day)
2. Isolate the epoch string
3. convert the epoch string to human readable date/time
4. rename the original file as samplesite.com.mmddYYYY.gz
View 2 Replies
ADVERTISEMENT
Jan 5, 2011
I'm developing a C++ application which is run on linux. I need to calculate epoch time for a given date and vice versa. (no of seconds elapsed since 1979-01-01) I used the following two methods.I need to convert the given date to epoch time and again convert that epoch time to the corresponding date.But the following methods doesn't give me the correct answer. Method to calculate the epoch time:
Code:
time_t HistoryCache::ConvertTimeToEpoc(const char* _zTime,const char* _zFormat)
{
struct tm tmTime;
strptime(_zTime,_zFormat, &tmTime);
[code]....
My problem is this. Lets think that the value I get as epoch time for the 2010-01-05:000000 is 1262649600. (lTime value) Then I use the same value (1262649600) as a input to the GetTimeStamp method, I didnt get the dateString as 2010-01-05:000000. The date is changed by one day.
View 2 Replies
View Related
Aug 14, 2010
I want to find out which process is eating RAM, I use this command:
Code:
ps -eo size,pid,user,command | sort -k1 -rn | head -10
but it displays with no human readable:
Code:
283364 4644 quanta /usr/lib/mozilla-firefox/firefox --sm-config-prefix /firefox-C3JYUC/ --sm-client-id 1014cd7d2d4000128169799000000044950019 --screen 0
230372 3635 mysql /usr/sbin/mysqld --defaults-file=/etc/mysql/my.cnf --basedir=/usr --datadir=/var/lib/mysql --pid-file=/var
[code]....
use 'awk' to convert 'size' column to human readable? I also read this thread but I get stuck in printing from $4 to NR.
View 8 Replies
View Related
Jun 10, 2011
get epoch time in high precision manner. You can take ref of wireshark gui, the packet arrival time. Its displayed in "1307691642.720358" manner.I mean in float. I need to get exactly the same thing. I know there is gettimeofday()/time() functions but they are returning INT time and not in float. What should I do ? (I am using fedora/kernel-2.6.18)
View 4 Replies
View Related
Oct 21, 2010
How can get human readable output from df -k in HP-UX?
View 5 Replies
View Related
Mar 28, 2011
The following is a script for making the bdf output of HP-UX in a human readable form .
Syntax for running the script is :-
# bdf | bdfrefine.pl
The output will be displayed in KB ,MB,GB or TB as per the disk space . Script details :-
#!/usr/bin/perl
######## SCRIPT FOR USER FRIENDLY bdf OUTPUT ##################
##-----------------------------------------------------------------######################
################# SLURPING INPUT ######################
##-----------------------------------------------------------------######################
[code]....
View 10 Replies
View Related
Mar 10, 2015
I want to display users quota in human readable format, so if the size is over 1 GB I want the quotas displayed in GBs
So when I issue the command below should I not get the results in GB ?
Code: Select allrepquota -sa
bob -- 87200M 400G 440G 879 0 0
dave -- 255G 400G 440G 3627 0 0
jim -- 10664M 400G 440G 230 0 0
tom -- 10737M 400G 440G 636 0 0
User bobs usage is 86GB, should 86GB not be displayed rather than 87200M?
View 1 Replies
View Related
May 23, 2010
i have installed Ossec and save it on my sql database but the timestamp of alert is not human readable, how to make it readable ? is there algorithm to make it readable?
View 1 Replies
View Related
Aug 2, 2010
I need to convert strings in the format YYYYMMDD to dates so I can perform date arithmetic.
View 4 Replies
View Related
Apr 9, 2010
I am in the process of learning some scripting, however I am running into a roadblock in specifying a certain time format in the array. Ideally I would like to use Here are the lines of text that I am interrogating:
1123,3/25/2010,00:14 Thu,33229
1124,3/26/2010,13:30 Fri,33230
1125,3/27/2010,04:49 Sat,33231
[code]...
View 2 Replies
View Related
Jun 8, 2011
[156750.000302] [Hardware Error]: No human readable MCE decoding support on this CPU type.
[156750.000327] [Hardware Error]: Run the message through 'mcelog --ascii' to decode.
[156750.000344] [Hardware Error]: Machine check events logged
I have been trying to find mcelog for my architecture (2.6.37.6-0.5-desktop #1 SMP PREEMPT 2011-04-25 21:48:33 +0200 i686 i686 i386 GNU/Linux). I am running openSuse version: openSUSE 11.4 (i586)
[Code]....
View 6 Replies
View Related
Jul 1, 2010
The top command by default displays in "k" ...how can I make it display in "M"?
View 2 Replies
View Related
Jul 12, 2010
I would really like to preserve a file's original modified date and pass it back to the file as the same attribute after a script has worked on it. I get a lot of JPEG files from different places on the Net which I either turn around and upload or burn to disk, and having the "original" date of either download or last mod in a graphics app would be for me, in the long run, a lot more helpful when deciding, for instance, which files to "recycle" or pass on backing up more than once.I've tried doing this on my own every now and then. Where I run into problems is that it appears "stat" and "date" use different formats for date information, and I can't seem to puzzle out how to "translate" one to the other satisfactorily for the latter command.
Just to give an example:
stat foo.jpg |grep Modify gives me
Modify: 2010-07-12 06:28:56.890625000 -0400
Passing that string as-is to date foo.jpg, I get the errordate: unknown option -- 0 and the usual semi-courteous suggestion to Try 'date --help' for more information.Somehow my TexInfo database got screwed up somewhere along the line and info dategives me the short article on date input formats, not the full documentation for the command
View 4 Replies
View Related
Apr 27, 2010
I'd like to have two gnome clock applets, one with the regular default time and date in the upper right hand corner (the default) and another set to epoch time. However, I can't figure out how to set the second gnome clock applet to display the epoch time. I'm running FC12.
View 4 Replies
View Related
Jan 11, 2010
I need to get the modified date on a file in linux to use in a script.I tried using 'ls -l' on the file, but this caused problems when the date turned from a single digit into a double. The reason for the problem was because I was parsing the result string on spaces.How can I get the date of the last time a file was modified so I can use it in a script? For example, if a file was modified on 1/11/2010, I need the 11.
View 2 Replies
View Related
Sep 6, 2009
- how to add the date/time to the email (message body)
- how to as the user to add a picture
- how add on an error page a button to send it back to the form so that the input does not get lost
Here the program so far:
<?php
/*
CHFEEDBACK.PHP Feedback Form PHP Script Ver 2.15.0
Generated by thesitewizard.com's Feedback Form Wizard 2.15.0.
[code]....
View 1 Replies
View Related
Aug 31, 2010
I am using cygwin in order to test a bash script that uses the ls -R command. When I use this, the access date of the subfolders are changed, and I need them to remain what they were before the command was run. I don't have access to a legitimate Linux system, so I'm not sure if this is the fault of cygwin or the ls command. The script is being used to find the last access date of all files underneath several subfolders and then return the latest date found in each subfolder as the last access date for that subfolder. For some reason, some of these folders have files in them that are newer than the folder's last access date, so the script is meant to give us a list of the true last access date for these folders.
View 5 Replies
View Related
Dec 3, 2009
How do I know the time and date of a file downloaded from the net. Is it possible at all? If I want to know when the downloaded file such as a text file was created ie written by the author if not mentioed at all in the entire document. The command I use locally to know file creation time is given below.
Code:
ls -l filename.txt
-rw-r--r-- 1 root root 691 Dec 3 11:12 filename.txt
View 2 Replies
View Related
Jan 13, 2010
I have a file called foo with a date string in it - and nothing else in the file
2010.01.13-22:28:28
I want to send this file content to date -s command so I can modify using a cron job.
I tried several ways to pipe the file contents to date command but did not work.
View 4 Replies
View Related
Jul 27, 2011
I have two different table in a database in mysql that has no share key with each other and I want to sort them with each other on their date time column I mean when I sort it row X of table A that is older that row Y of table B comes earlier.
View 3 Replies
View Related
Feb 8, 2010
here is the problem code using strptime() function.
==================
#include <stdio.h>
#include <string.h>
#include <time.h>
[code]....
Why are the Month and Year so messed up? I am using strptime() according to the man page.
View 2 Replies
View Related
Jan 29, 2010
I have managed to create a HTML file inside python code,convert this to a PNG file through a Python script ?
EDIT: Details added: I have a python script which generates map-legends in the form of an html file. The legend generated have to be pasted on a map which is in a png format. A png format file can be pasted on another png format file easily. But because the legends generated are in a html format I cannot paste it on the map file !!
EDIT: Details added: I did Googling first but it resulted in various soft wares for above purpose which I don't want !!
View 12 Replies
View Related
Apr 3, 2011
My problem is to convert an odt file to pdf using php. I wrote an article in odt and I'd want to download it in pdf from my site. I know "fpdf", but it doesn't convert from odt. Someone says to convert from odt to html then to pdf... but some others says NO! Well, do you know a way? (may be also different from odt to pdf, e.g. from latex to pdf).
View 12 Replies
View Related
Jul 9, 2011
I like the easy readability of fwlogwatch (as compared to the Log File Viewer). But fwlogwatch doesn't display port number or date when I run it in terminal.
Is there a log viewer that displays clean like fwlogwatch but displays all the information that Log File Viewer does?
View 1 Replies
View Related
Mar 12, 2011
I tried to write a cron job in Fedora13 as follows
#!/bin/bash
today='date +%d%m%Y'
cp /var/www/html/site1/module.txt /home/amitha/Desktop/backup/$today.module.txt
[code]....
View 3 Replies
View Related
May 5, 2010
i have text file that filename contain the date of creation (i.e 2010.05.02.log).I would like to create a script that:-Ask for start date -Ask for end date- Concatenate all file on the requested period by date order.
View 1 Replies
View Related
Oct 3, 2009
I've got fedora 11 set up to use network time protocol to sync my laptop's date & time when I'm on-line. The question is simple really, I've added a local universality's time server (what is public) and it's live. but it's added to the end of the default time servers what come with fedora. How do I get fedora to just use the local time server, is it a case of removing the default time servers for fedora, but there is a box what says advanced options which are. sync system clock before starting service ???? & use Local time source (( is that the same as the local ntp server that I've got set up ))Hope some body can help me with the network time protocol part of Date/Time settings.
View 9 Replies
View Related
Jul 9, 2010
I am new to Scripting. I am trying to find out particular file is modified in last one hour or not in script and then if that file is modified in last one hour i need to copy that file to another directory.Can any one please provide me how to check the file is modified in one hour or not?
View 3 Replies
View Related
Mar 23, 2011
I need to be able to compare a file date with system date and delete files older than 30 days.
the file name is basically
error_log.03222011
of course the extension is the date the file was created.
Oh and before i get hammered I looked everywhere but am unable to make sense of what I found.
View 3 Replies
View Related
Oct 28, 2010
I want to synchronize my time to a time server in Singapore. How can i do so with the Time and Date in System - Administration - Time and Date?
View 4 Replies
View Related