The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
.
google unix.com



UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
shell script to find and copy the files creted in the year 2006 to another directory manas6 Shell Programming and Scripting 2 04-01-2008 04:04 AM
Need year to display from ftped files list Vrgurav Shell Programming and Scripting 1 03-04-2008 11:01 AM
to get list of files of a perticular range of time useless79 Shell Programming and Scripting 1 11-07-2007 03:53 AM
how to know year create/modified files? blesets UNIX for Dummies Questions & Answers 5 03-10-2007 12:20 AM
Need help to access/mount so to access folder/files on a Remote System using Linux OS S.Vishwanath UNIX for Dummies Questions & Answers 2 07-30-2001 09:17 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 07-12-2005
pradeepmacha pradeepmacha is offline
Registered User
  
 

Join Date: Mar 2005
Posts: 20
Smile find files with a perticular year of access

Hello all,
Might be a silly question, on my AIX machine the year had changed to 2022 and some files were accessed on this date hence the time stamp on these files is with year 2022, there are many such files. i want to list all these file from the root dir and subdir with 2022 year time stamp. can any one help me on this. i tried using find command with expression but could not frame it.

Kindly help me with this.

Regards,
Pradeep Kulkarni.
  #2 (permalink)  
Old 07-12-2005
vino's Avatar
vino vino is offline Forum Staff  
Supporter (in vino veritas)
  
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,798
Try this.

Code:
find / -exec ls -la {} \; | awk '{ if ( $8==2003) printf $0"\n" }'
Vino
  #3 (permalink)  
Old 07-12-2005
pradeepmacha pradeepmacha is offline
Registered User
  
 

Join Date: Mar 2005
Posts: 20
hello Vino,
Thanks for the solution i think it works, and i think i should mention 2022 instead of 2003 in that command right.
ca you do a favour, can you elobrate this command for me i mean explain

Thanks Pradeep
  #4 (permalink)  
Old 07-12-2005
vino's Avatar
vino vino is offline Forum Staff  
Supporter (in vino veritas)
  
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,798
Quote:
Originally Posted by pradeepmacha
hello Vino,
Thanks for the solution i think it works, and i think i should mention 2022 instead of 2003 in that command right.
ca you do a favour, can you elobrate this command for me i mean explain

Thanks Pradeep
Yes, it should be 2022.

Mea culpa.

find /

Find all file starting from / directory.

-exec ls -la {} \;

For each file found, execute ls -la on that file.

| awk '{ if ( $8==2022) printf $0"\n" }'

Pipe each ls -la to awk. If the eight field is 2022, print the file name.

Look into man find for different possible uses of find.

Vino
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 02:01 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0