Re: Another fgrep query
From: Stein Arne Storslett (sastorsl_at_THOU.SHALT.NOT.SPAM.online.no)
Date: 07/30/03
- Next message: Dave Hedgehog: "Re: Another fgrep query"
- Previous message: Stein Arne Storslett: "Re: fgrep query"
- In reply to: Dave Hedgehog: "Another fgrep query"
- Next in thread: Dave Hedgehog: "Re: Another fgrep query"
- Reply: Dave Hedgehog: "Re: Another fgrep query"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 30 Jul 2003 10:16:48 GMT
<x@x.com> wrote in <bg7v5j$4ab$1@home.itg.ti.com>:
> I have a directory which contains loads (probably thousands) of different
> files.
> I want to search for a string but when I try an fgrep it bombs out because
> the 'arg list is too long'.
> I know roughly what date the data I am looking for was saved so is there a
> way I can limit my fgrep to only search files which were saved on a certain
> day.
> I'm sure there probably is but I don't have the knowledge to do it.
> Thanks again,
> Dave
Let's say that the files you are looking for were created 60 days ago,
you could use the following:
find . -type f -mtime 60 | xargs fgrep -l 'string'
Note! It seems that what -mtime finds depends on the system or the
version of find.
On HP-UX 11i I found that this found all files created 60 days ago, but
only files created from 00:00 until the current time today.
On Solaris 2.6 I found that this found all files created in the 24 hours
which were 60 days ago.
What you can do is that you do an "ls -l", and find you self two
reference files. One created _before_ the files you want to search, and
one created _after_ the files you want to search.
You then do:
find . -type f -newer file1 -a ! -newer file2 | xargs fgrep -l "string"
man find
man grep
-- Stein Arne
- Next message: Dave Hedgehog: "Re: Another fgrep query"
- Previous message: Stein Arne Storslett: "Re: fgrep query"
- In reply to: Dave Hedgehog: "Another fgrep query"
- Next in thread: Dave Hedgehog: "Re: Another fgrep query"
- Reply: Dave Hedgehog: "Re: Another fgrep query"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|