|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Problems extracting some information
Hi there! Well, I'm writing a script to obtain certain information about files. Specifically, I want to get the information about those files which last access were in the last 24 hours, so I'm doing something like this: Code:
find <directory_name> -atime -1 -printf '%f %a\n' I would also like to add some extra information to this result: I would like to obtain the date and time of the last modification of these files if that is also during the last 24 hours, so that I might use '%t' anywhere. The problem is that not all files were also modified during this time. How could I implement this condition in the code? I want a result like this: Code:
<file_name1> <last_access_time1>
<file_name2> <last_access_time2> <last_modification_time2>
<file_name3> <last_access_time3>
<file_name4> <last_access_time4>
<file_name5> <last_access_time5> <last_modification_time5>
... ... ...where files 2 and 5 were modified within the last 24 hours. Is there a way to insert conditions to fulfill before printing the results? Or anything equivalent to get this behaviour? Thanks in advance. Regards. |
| Sponsored Links | ||
|
|
#2
|
||||
|
||||
|
Code:
find . -name "*" -type f -mtime -1 -exec stat -c "{} %x %y" {} \;---------- Post updated at 01:17 PM ---------- Previous update was at 01:15 PM ---------- And if you want those angles Code:
find . -name "*" -type f -mtime -1 -exec stat -c "<{}> <%x> <%y>" {} \; |
| Sponsored Links | ||
|
|
#3
|
|||
|
|||
|
Yes, that shows me the last modification time and last access time, but only for the files accessed and modified within the last 24 hours. I would be also interested in those files accessed within the last 24 hours, but not modified...
Thank you for your answer anyway ![]() |
|
#4
|
||||
|
||||
|
Code:
find . -name "*" -type f -atime -1 -a -mtime +1 -exec stat -c "<{}> <%x> <%y>" {} \;Accessed in last 24 hours but not modified in last 24 hours |
| Sponsored Links | |
|
|
#5
|
|||
|
|||
|
Thank you so much for your help, msabhi
![]() |
| Sponsored Links | ||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Extracting relevant information from syslogs. | lewk | Shell Programming and Scripting | 2 | 09-12-2012 07:04 AM |
| extracting information from multiple files | houkto | Shell Programming and Scripting | 4 | 11-15-2011 02:51 PM |
| Problems with extracting information | c0mrade | Shell Programming and Scripting | 0 | 11-17-2008 03:17 PM |
| Extracting information from text fields. | spindoctor | UNIX for Dummies Questions & Answers | 24 | 06-09-2007 01:17 PM |
| Extracting information from a template | Ernst | Shell Programming and Scripting | 4 | 03-07-2007 12:18 AM |
|
|