Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Does 'grep' update a file's access date/time? Post 302822957 by DGPickett on Tuesday 18th of June 2013 12:19:17 PM
Old 06-18-2013
Yes, it is less durable than the archive bit in Windows, and so of little use. Most practical apps use the date modified, to control backup and archiving. For casual use, "find -mtime -<days>" is good, but for precise set definition you need something like:
Code:
touch marker_new
sleep 1 # get out of new marker file's second
find ... -newer marker_last ! -newer marker_new | ...
mv -f marker_last marker_done # in case you need a rerun
mv marker_new marker_last

---------- Post updated at 12:19 PM ---------- Previous update was at 12:15 PM ----------

Yes, it is less durable than the archive bit in Windows, and so of little use. Most practical apps use the date modified, to control backup and archiving. For casual use, "find -mtime -<days>" is good, but for precise set definition you need something like:
Code:
touch marker_new
sleep 1 # get out of new marker file's second
find ... -newer marker_last ! -newer marker_new | ...
mv -f marker_last marker_done # in case you need a rerun
mv marker_new marker_last

You need to bracket your files with two dates in the past. If you start in th current second, you might miss files modified later in that second. A second is a long time for a modern computer ! Smilie
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

file access inode update

When is a file "accessed" according to UNIX? For example: gzipping a file will not change the access time. (1 Reply)
Discussion started by: dangral
1 Replies

2. Shell Programming and Scripting

grep time and date

Hi, I have a file which is a result of a script running every two minutes. What I wanted to do is to grep a specific date and time (hour and minute) from the file and then count the occurance of 201. I need to get the result of occurance of 201 every 5 minutes. What should I include in my... (8 Replies)
Discussion started by: ayhanne
8 Replies

3. Shell Programming and Scripting

Processing a log file based on date/time input and the date/time on the log file

Hi, I'm trying to accomplish the following and would like some suggestions or possible bash script examples that may work I have a directory that has a list of log files that's periodically dumped from a script that is crontab that are rotated 4 generations. There will be a time stamp that is... (4 Replies)
Discussion started by: primp
4 Replies

4. Shell Programming and Scripting

grep to show date/time of file the string was found in.

I've seen several examples of grep showing the filename the string was found in, but what I really need is grep to show the file details in long format (like ls -l would). scenario is: grep mobile_number todays_files This will show me the string I'm after & which files they turn up in, but... (2 Replies)
Discussion started by: woodstock
2 Replies

5. Shell Programming and Scripting

Show date/time with tail|grep command

Hi, I have a log file without date/time, and I want that everytime tail|grep find something it displays the date/time and the line. I have tried something like this command but without any luck to display the date/time: tail -F catalina.out | sed "s/^/`date `/" | egrep ... (6 Replies)
Discussion started by: julugu
6 Replies

6. Shell Programming and Scripting

grep - date & time range

Hi, I need to search email files by date & time range in email files. The timezone is not important. Can someone plz advise how i can do this ? For e.g A user can specify only A single date A date range date & time range Below is part of the email file. (4 Replies)
Discussion started by: coolatt
4 Replies

7. Shell Programming and Scripting

how to update date part with new increment date time

hi experts, my requirement is like this i need to develop a shell script to update date part with new incremental date time in file some 'X' which is kept at some server location incrementing every two hours.as i am new to this scripting i need support from u people,thanx in advance (1 Reply)
Discussion started by: amanmro
1 Replies

8. Shell Programming and Scripting

Grep the Content of a LOG File which has latest Date and Time

Hi All, Need a small help. I have a log file which keeps updating for every Minute with multiple number of lines. I just want to grep few properties which has latest Date and Time to it. How do i do it? I wanted to grep a property by name "Reloading cache with a maximum of" from the... (4 Replies)
Discussion started by: nvindraneel
4 Replies

9. UNIX Desktop Questions & Answers

grep a range of time & date

how can i grep a range? i have a text file with the following text: result.log.00:2012/01/02 12:00:07.422 LOG STARTED HERE N6Kashya29MemoryShieldScheduler_AO_IMPLE, pid=8662/8658, config=(alertThreshold=10,alertLevel=0,killThreshold=7200,coreThreshold=0,full=1), deltaTime=0,... (1 Reply)
Discussion started by: boaz733
1 Replies

10. Shell Programming and Scripting

Access log field - using awk to pull date/time

hey guys. the following line is a line taken from apache's access_log 10.10.10.10 - jdoe "GET /images/down.gif HTTP/1.1" 304 I'm concerned about the field that has the date and time in it. if assuming the delimiter in the file is a space, then the fourth field will always have the date... (5 Replies)
Discussion started by: SkySmart
5 Replies
DBIx::Class::TimeStamp(3pm)				User Contributed Perl Documentation			       DBIx::Class::TimeStamp(3pm)

NAME
DBIx::Class::TimeStamp - DBIx::Class extension to update and create date and time based fields DESCRIPTION
Works in conjunction with InflateColumn::DateTime to automatically set update and create date and time based fields in a table. SYNOPSIS
package My::Schema; __PACKAGE__->load_components(qw( TimeStamp ... Core )); __PACKAGE__->add_columns( id => { data_type => 'integer' }, t_created => { data_type => 'datetime', set_on_create => 1 }, t_updated => { data_type => 'datetime', set_on_create => 1, set_on_update => 1 }, ); Now, any update or create actions will update the specified columns with the current time, using the DateTime inflator. This is effectively trigger emulation to get consistent behavior across databases that either implement them poorly or not at all. METHODS
get_timestamp Returns a DateTime object pointing to now. Override this method if you have different time accounting functions, or want to do anything special. The date and time objects in the database are expected to be inflated. As such you can be pretty flexible with what you want to return here. AUTHOR
J. Shirley <jshirley@gmail.com> CONTRIBUTORS
Florian Ragwitz (Porting to DBIx::Class::DynamicDefault) LTJake/bricas COPYRIGHT &; LICENSE Copyright 2009 J. Shirley, all rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.14.2 2010-09-05 DBIx::Class::TimeStamp(3pm)
All times are GMT -4. The time now is 09:34 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy