data:
i have a file that contains chunks similar to the above.
i want to parse this file and skip over chunks that have entry time which is older than 60 days. Meaning, DO NOT output those chunks.
Please note, some of the chunks in the data file do not have "entry_time". so for those entries, i want this script to output the chunk and move on to the next chunk.
So in other words, i want to do the date subtraction only on chunks that have "entry_time".
this is the code i'm using:
how do i substract the entry time from the time now??? and also, is this script good enough to do what i need?
IMO you are better off using perl for this problem...the "entry_time" is given in seconds since the *nix Epoch...and if your awk can figure out the current Epoch then you'd be able to subtract the "now" Epoch from the "entry_time" Epoch and dole out the desired chunks to an output file.
perl comes with the date and time routines builtin...so if I were you I'd doing this in perl otherwise feel free to ignore this post...
IMO you are better off using perl for this problem...the "entry_time" is given in seconds since the *nix Epoch...and if your awk can figure out the current Epoch then you'd be able to subtract the "now" Epoch from the "entry_time" Epoch and dole out the desired chunks to an output file.
perl comes with the date and time routines builtin...so if I were you I'd doing this in perl otherwise feel free to ignore this post...
unfortunately, i cant write in a language that i'm unfamiliar with. if this can be done in perl, please, if you can, supply the perl code.
im pretty sure theres goto be a way around this with awk.
That'd depend on what system you are on ie your OS...because if you are using gawk then you certainly can...just look up the systime function inside the gawk man page...
if your awk can figure out the current Epoch then you'd be able to subtract the "now" Epoch from the "entry_time" Epoch and dole out the desired chunks to an output file.
Although it is not a well known fact, all awk releases are able to retrieve the current epoch time by standard :
These 2 Users Gave Thanks to jlliagre For This Post:
How to get Julian date (Three digit) of a given date (Not current date)? I do not have root privilege - so can not use date -d. Assume that we have three variables year, month and date.
Thx (5 Replies)
Hello, i need calculate the day before in this format aammdd, for example if i have 110701 i need a script to return the value 110630.
I only know what with this comand "date %y%m%d" return the date system.
Sorry for my english, it is very bad, i know...
Thank you very much
Grettings! (1 Reply)
Hi,
I have a large data frame as shown below, where data is separated into years.
10 May 2011 Created: 10 May 11 15:05 GMT Scale: SIO-2005 and others
GC-MD, Cape Grim, Tasmania, Lat.: 40.68S, Lon.: 144.69E, Alt: 94m above sea level
You can use the following format in Fortran to read data... (4 Replies)
Hi Guys,
Please somebody give me a hand to show the Month & Year in assigning to a variable and with format "MMMYY" (i.e. Jul11). See below preferred output.
I tried using this but it is giving me the current month...
date = "`date +%b%y`"
Aug11
DESIRED OUTPUT:
Jul11
... (3 Replies)
Hi everyone, just some simple question...
i've been using a awk script to calculate my data...
i have 3 files:
file a1.txt:
2
3
4
5
3
4
file a2.txt:
4
5
6
7
8 (1 Reply)
Hi,
I have two time series data (below) merged into a file.
t1 and t2 are in unit of second
I want to calculate the average of V1 every second and count how many times "1" in V2 is occur within a second
Input File:
t1 V1 t2 V2
10.000000... (5 Replies)
Hello,
I'm using ls -laR to print out a list of file and folders. I want to print only the permission, file size and file name. Also, excluding the '.' and '..'.
result from ls -laR:
total 6
drwxr-xr-x 8 user staff 512 Nov 28 16:17 .
drwxr-x--- 16 user staff 1024... (3 Replies)
I want to calculate the date of next satureday of current date using shell script.
Suppose, today is 27-feb-08
I want to get the date of next satureday, which means 01-mar-08, in the formate '' YYMMDD ".
I do this in ksh..
Please tell me any type of command which help me out.
Thanks in... (3 Replies)