- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Question on searching files by date stamp.
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-02-2006 08:10 AM
тАО08-02-2006 08:10 AM
I am trying to search file in one of the directory by date stamp (for ex. Jun 12) and ll | grep -i and using sed it's not working. Any idea on how to do this.
Thanks in advance.
Mike
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-02-2006 08:13 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-02-2006 10:46 AM
тАО08-02-2006 10:46 AM
Re: Question on searching files by date stamp.
find ./ -type f -mtime 51 -exec ls -l {} \;
It may look ugly on the surface but it is much better for finding one or more files of a specific age.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-02-2006 11:02 AM
тАО08-02-2006 11:02 AM
Re: Question on searching files by date stamp.
Well, using 'find's 'mtime' argument means that you have to calculate the number of days (24-hour increments) old the target date is from now. A better way, if you want to take this approach is to create two reference points (boundries):
# touch -amt 06112359 /tmp/f1
# touch -amt 06130000 /tmp/f2
# find /pathname -xdev -type f -newer /tmp/f1 -a ! -newer /tmp/f2
This finds all *files* in '/pathname' that are newer than boundry-1 (based on modification time) and younger (not newer) than boundry-2 (file #2's modification time).
The '-xdev' switch prevents crossing mountpoints.
See the manpages for 'touch' and 'find' for more information.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-02-2006 03:21 PM
тАО08-02-2006 03:21 PM
Re: Question on searching files by date stamp.
I know why the ll| grep -i "Jun 1" did not work for me because the space was incorrect between "Jun & the 1" and now I know what I was doing was right. If you have any other way to search file in directory by date stamp that will be great.
For now the ll | grep -i "Jun 1" work. Any other ideas will help.
Basically I am just trying to find out how to search files in directory that has the date stamp of (for example "Jun 1").
Thanks,
Mike
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-02-2006 05:47 PM
тАО08-02-2006 05:47 PM
Re: Question on searching files by date stamp.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-03-2006 12:22 AM
тАО08-03-2006 12:22 AM
Re: Question on searching files by date stamp.
As Bill and I have emphasized, using 'find' is a more exact approach. For example, do you want "Jun 12" only if it is within the current 6-months or do you want any "Jun 12" from any year.
If you don't care, and you want to use 'grep', then a way to find matches for dates like "Jun
grep "Jun[ ]*1[ ]"
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-04-2006 04:22 AM
тАО08-04-2006 04:22 AM
Re: Question on searching files by date stamp.
Mike