The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
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

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 07-24-2006
Registered User
 

Join Date: Mar 2006
Location: Mumbai
Posts: 67
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
Reply With Quote
Forum Sponsor
  #2  
Old 07-24-2006
tayyabq8's Avatar
Moderator
 

Join Date: Nov 2004
Location: Bahrain
Posts: 555
Code:
find . ! -newer ./yourfile -print
Reply With Quote
  #3  
Old 07-24-2006
Registered User
 

Join Date: Mar 2006
Location: Mumbai
Posts: 67
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 "./ "
Reply With Quote
  #4  
Old 07-24-2006
tayyabq8's Avatar
Moderator
 

Join Date: Nov 2004
Location: Bahrain
Posts: 555
Try:
Code:
find . ! -newer aaa -print | sed -e 's_^./__'
where" __ " is double underscore.
Reply With Quote
  #5  
Old 07-24-2006
Registered User
 

Join Date: Mar 2006
Location: Mumbai
Posts: 67
Well that works fine !! is _(underscore) a substitute for "/" in sed command.
As sed has the following syntax sed -e 's/a/b'
Reply With Quote
  #6  
Old 07-24-2006
tayyabq8's Avatar
Moderator
 

Join Date: Nov 2004
Location: Bahrain
Posts: 555
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
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 11:23 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0