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
search by modified date kotasateesh Shell Programming and Scripting 4 06-24-2008 06:59 AM
greping date in a file ali560045 Shell Programming and Scripting 3 02-20-2008 03:30 AM
compare files in the system with last modified date bsandeep_80 Linux 6 01-14-2008 08:56 PM
Last Modified Date cengiz Shell Programming and Scripting 12 06-27-2005 11:05 PM
How do I get the last modified date of a file? akpopa UNIX for Dummies Questions & Answers 2 08-29-2001 12:08 PM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-08-2008
ali560045's Avatar
Registered User
 

Join Date: Oct 2007
Posts: 170
greping certain modified date

i have a k shell script that grep less than certain modified date
-------------------------------------------------
#!/bin/ksh

for i in *
do

day=`ls -ltr | grep $i | tr -s " " | cut -d " " -f6-7 | awk 'substr($0,7,4)substr($0,1,5)substr($0,11)<"Feb 1"' `
echo $day
done
-------------------------------------------------------------------

if suppose i want to grep only those date less than Feb 1 2007,how to put this logic in ? also the above script shows me only the o/p as

Dec 25
dec 24

i have jan files also,but it is not showing up

help me

Last edited by ali560045; 02-08-2008 at 03:17 AM.
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 02-08-2008
Moderator
 

Join Date: Dec 2003
Location: /ksh93
Posts: 849
From your use of the ls command, it looks like you are trying to find files whose date is earlier than Feb 1, 2007.

Why not just use the find command with the appropriate options?
Reply With Quote
  #3 (permalink)  
Old 02-08-2008
ali560045's Avatar
Registered User
 

Join Date: Oct 2007
Posts: 170
i really not an expert in unix shell.....

so basically can u tell me in r best possible way how to use find command here. help me in this

Last edited by ali560045; 02-10-2008 at 11:44 PM.
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 03:39 PM.


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

Content Relevant URLs by vBSEO 3.2.0