![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | 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 here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| how to find files older than 2 hours | pt14 | AIX | 3 | 03-05-2008 09:31 AM |
| how to find files older than 4hours in HP-UX | caprikar | UNIX for Advanced & Expert Users | 3 | 11-27-2007 02:23 PM |
| only find files older than x minutes old | dsimpg1 | Shell Programming and Scripting | 1 | 05-18-2006 08:48 PM |
| Find files older than 20 days & not use find | halo98 | Shell Programming and Scripting | 2 | 05-18-2006 11:19 AM |
| Find files older than 5 days and remove tem after listing | ypatel6871 | UNIX for Dummies Questions & Answers | 1 | 09-05-2005 08:00 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
find files older than a given file
I want to find out the files that are older than a given file in the current
directory ...Can anyone help |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
Code:
find . ! -newer ./yourfile -print |
|
#3
|
|||
|
|||
|
thanks buddy !! but it also prints the file itself ( yourfile)which acts as the input.....also it gives output as this
------------- . ./a.txt ./b.txt ---------- can i avoid the "./ " |
|
#4
|
||||
|
||||
|
Try:
Code:
find . ! -newer aaa -print | sed -e 's_^./__' |
|
#5
|
|||
|
|||
|
Well that works fine !! is _(underscore) a substitute for "/" in sed command.
As sed has the following syntax sed -e 's/a/b' |
|
#6
|
||||
|
||||
|
Yes "_" is delimiter here, I used it because "/" was in our search string also, so to avoid confusion it was "_" there, you can use any character as delimiter, but you have to take care of it in your syntax later on.
Regards, Tayyab |
||||
| Google The UNIX and Linux Forums |