Sponsored Content
Top Forums Shell Programming and Scripting How to pick only the files which are generated in one hour? Post 302769070 by akore83 on Monday 11th of February 2013 06:30:51 AM
Old 02-11-2013
Linux How to pick only the files which are generated in one hour?

Hello Masters,
I need one help.
I want to copy the files which are continuously generating on one server.
But this would be on hourly basis.

e.g.
Code:
-rw-rw-r-- 1 akore akore 0 Feb 12 03:20 test1.log 
-rw-rw-r-- 1 akore akore 0 Feb 12 03:42 test2.log 
-rw-rw-r-- 1 akore akore 0 Feb 12 04:22 test3.log 
-rw-rw-r-- 1 akore akore 0 Feb 12 04:50 test4.log 
-rw-rw-r-- 1 akore akore 0 Feb 12 05:22 test5.log 
-rw-rw-r-- 1 akore akore 0 Feb 12 05:42 test6.log 
-rw-rw-r-- 1 akore akore 0 Feb 12 06:55 test7.log 
-rw-rw-r-- 1 akore akore 0 Feb 12 06:58 test8.log 
-rw-rw-r-- 1 akore akore 0 Feb 12 07:17 test9.log 
-rw-rw-r-- 1 akore akore 0 Feb 12 07:28 test10.log

From above first I need to copy the files which are generated between Feb 12 03:00 to Feb 12 03:59.
Code:
Then Feb 12 04:00 to Feb 12 04:59
Then Feb 12 05:00 to Feb 12 05:59

and so on.

That means in 24 hrs my script will copy 24 times.
I need this on daily basis.
I will set a cronjob for this.
But not sure how to pick.
Please help me over here so I can copy the files on ourly basis.
Thanks in advance

Last edited by Scrutinizer; 02-11-2013 at 09:17 AM.. Reason: code tags
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to list all the files which are not generated today

How to list all the files which are not generated today, and move all the above files to backup dir. (2 Replies)
Discussion started by: redlotus72
2 Replies

2. Shell Programming and Scripting

Ftp all the generated files

Hi All, I'm working on a ftp shell script in which I'm tranfering files from one sever to another using ftp. Some program generates files at undefined time & throughout the day. I have to transfer the files time to time.. i.e. once the file is generated, it should be transfered at the very... (3 Replies)
Discussion started by: im_new
3 Replies

3. UNIX for Advanced & Expert Users

Type v for generated files

Hi All, I was checking some of the files and I got the following entries:- =============== v, 664, serv, serv, version.txt, exe L, 775, serv, serv, start.sh, eventserv ================ Could someone please tell me what does the type"v" and "L" represent to. I have not... (2 Replies)
Discussion started by: shubhranshu
2 Replies

4. Shell Programming and Scripting

need to pick out files which are not of zero bytes

I need a scriptto print only those files from a list of files starting with STMT* which are not of zero bytes ...i.e they have some size if these are the files 631 -rw-r--r-- 1 assrisa assrisa 39099 Aug 19 07:16 STMT_05_D1090819_T071320 -rw-r--r-- 1 assrisa assrisa 0 Aug 19... (2 Replies)
Discussion started by: viv1
2 Replies

5. Solaris

core files not getting generated

Hi, We have an application ASPA . The application related processes are running in /ASPA/bin directory . now whenever a process terminates abruptly , a core file should be generated (correct me if i am wrong) in the /ASPA/bin directory . But i am not able to see any such files . The... (4 Replies)
Discussion started by: asalman.qazi
4 Replies

6. Shell Programming and Scripting

Getting list of files generated last 10 seconds

I was trying to figure out in Korn shell but this may apply elsewhere how to generate a list of files from a directory created in the last 10 seconds or less. I have used the find command in the past with -mtime which is measured in days to get a list of files older than say 7 days for example. ... (1 Reply)
Discussion started by: lee_murray
1 Replies

7. Shell Programming and Scripting

Files generated by a particular user

Hi I have the following files generated by different users on a directory -rw-rw-r-- 1 NAME1 database03 809 Nov 17 10:41 PCAS_CARD_TRANS_OFF.1111171041.lg -rw-rw-r-- 1 richard ccsdba 10968411 Nov 17 10:43 load_123_RX0_0.1111171016.lg -rw-rw-r-- 1 DEV db03 10713 Nov 17... (5 Replies)
Discussion started by: bobby1015
5 Replies

8. Shell Programming and Scripting

Files generated today

I would like to find the Files which are generated today in the current directory: I use the commad ls -lrt * | egrep " `date "+%b"` * `date "+%d"` to acheive this. Is there any better way to acquire the same. Multiple answers will be great. Thanks (3 Replies)
Discussion started by: kusathy
3 Replies

9. Shell Programming and Scripting

How to tail real time file Generated every hour?

Hi Guys, I am developing a script to monitor log file Generated every hour. When creating a new file scripts not working. My Code . I want to monitor GatewayTransaction.yyyymmdd-hh.log while true; do newdate=$(date '+%Y%m%d') ; nowdate=$(date '+%Y%m%d-%H.log'); tail -f... (7 Replies)
Discussion started by: ooilinlove
7 Replies

10. Shell Programming and Scripting

Pick the last one hour lines from log matching this pattern.

Hello please help me on this, pick the last one hour lines from the log, which have the prefix time format like this. log message log message i tried to do grep, but that failed. my code grep '(date +)' log_file_path This checking only the current time stamp. How to get the log... (16 Replies)
Discussion started by: santosh2626
16 Replies
HTTP::Date(3)						User Contributed Perl Documentation					     HTTP::Date(3)

NAME
HTTP::Date - date conversion routines SYNOPSIS
use HTTP::Date; $string = time2str($time); # Format as GMT ASCII time $time = str2time($string); # convert ASCII date to machine time DESCRIPTION
This module provides functions that deal the date formats used by the HTTP protocol (and then some more). Only the first two functions, time2str() and str2time(), are exported by default. time2str( [$time] ) The time2str() function converts a machine time (seconds since epoch) to a string. If the function is called without an argument or with an undefined argument, it will use the current time. The string returned is in the format preferred for the HTTP protocol. This is a fixed length subset of the format defined by RFC 1123, represented in Universal Time (GMT). An example of a time stamp in this format is: Sun, 06 Nov 1994 08:49:37 GMT str2time( $str [, $zone] ) The str2time() function converts a string to machine time. It returns "undef" if the format of $str is unrecognized, otherwise whatever the "Time::Local" functions can make out of the parsed time. Dates before the system's epoch may not work on all operating systems. The time formats recognized are the same as for parse_date(). The function also takes an optional second argument that specifies the default time zone to use when converting the date. This parameter is ignored if the zone is found in the date string itself. If this parameter is missing, and the date string format does not contain any zone specification, then the local time zone is assumed. If the zone is not ""GMT"" or numerical (like ""-0800"" or "+0100"), then the "Time::Zone" module must be installed in order to get the date recognized. parse_date( $str ) This function will try to parse a date string, and then return it as a list of numerical values followed by a (possible undefined) time zone specifier; ($year, $month, $day, $hour, $min, $sec, $tz). The $year will be the full 4-digit year, and $month numbers start with 1 (for January). In scalar context the numbers are interpolated in a string of the "YYYY-MM-DD hh:mm:ss TZ"-format and returned. If the date is unrecognized, then the empty list is returned ("undef" in scalar context). The function is able to parse the following formats: "Wed, 09 Feb 1994 22:23:32 GMT" -- HTTP format "Thu Feb 3 17:03:55 GMT 1994" -- ctime(3) format "Thu Feb 3 00:00:00 1994", -- ANSI C asctime() format "Tuesday, 08-Feb-94 14:15:29 GMT" -- old rfc850 HTTP format "Tuesday, 08-Feb-1994 14:15:29 GMT" -- broken rfc850 HTTP format "03/Feb/1994:17:03:55 -0700" -- common logfile format "09 Feb 1994 22:23:32 GMT" -- HTTP format (no weekday) "08-Feb-94 14:15:29 GMT" -- rfc850 format (no weekday) "08-Feb-1994 14:15:29 GMT" -- broken rfc850 format (no weekday) "1994-02-03 14:15:29 -0100" -- ISO 8601 format "1994-02-03 14:15:29" -- zone is optional "1994-02-03" -- only date "1994-02-03T14:15:29" -- Use T as separator "19940203T141529Z" -- ISO 8601 compact format "19940203" -- only date "08-Feb-94" -- old rfc850 HTTP format (no weekday, no time) "08-Feb-1994" -- broken rfc850 HTTP format (no weekday, no time) "09 Feb 1994" -- proposed new HTTP format (no weekday, no time) "03/Feb/1994" -- common logfile format (no time, no offset) "Feb 3 1994" -- Unix 'ls -l' format "Feb 3 17:03" -- Unix 'ls -l' format "11-15-96 03:52PM" -- Windows 'dir' format The parser ignores leading and trailing whitespace. It also allow the seconds to be missing and the month to be numerical in most formats. If the year is missing, then we assume that the date is the first matching date before current month. If the year is given with only 2 digits, then parse_date() will select the century that makes the year closest to the current date. time2iso( [$time] ) Same as time2str(), but returns a "YYYY-MM-DD hh:mm:ss"-formatted string representing time in the local time zone. time2isoz( [$time] ) Same as time2str(), but returns a "YYYY-MM-DD hh:mm:ssZ"-formatted string representing Universal Time. SEE ALSO
"time" in perlfunc, Time::Zone COPYRIGHT
Copyright 1995-1999, Gisle Aas This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.16.2 2012-03-30 HTTP::Date(3)
All times are GMT -4. The time now is 06:21 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy