Re: Another fgrep query

From: Stein Arne Storslett (sastorsl_at_THOU.SHALT.NOT.SPAM.online.no)
Date: 07/30/03


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


Relevant Pages

  • Re: Another fgrep query
    ... > I have a directory which contains loads of different ... > I want to search for a string but when I try an fgrep it bombs out because ... > way I can limit my fgrep to only search files which were saved on a certain ... Lazlo's Chinese Relativity Axiom: ...
    (comp.unix.shell)
  • Another fgrep query
    ... I have a directory which contains loads of different ... I want to search for a string but when I try an fgrep it bombs out because ...
    (comp.unix.shell)
  • Re: Another fgrep query
    ... Dave Hedgehog wrote: ... > I have a directory which contains loads of different ... > I want to search for a string but when I try an fgrep it bombs out because ... > way I can limit my fgrep to only search files which were saved on a certain ...
    (comp.unix.shell)
  • Re: XML whackyness
    ... oDOM.Load loads the file directly, whereas oDOM.LoadXML loads a string. ... It is essential you don't try and read the XML file manually and then pass ... magic bytes and know to treat the xml data as being in the utf-8 character ...
    (microsoft.public.vb.general.discussion)
  • Re: What if structure is faster? or not?>
    ... You can see that the first type branches ... branches out of the statement or loads the ... string, assigns it, and continues execution. ... .method public hidebysig static void Maincil managed ...
    (microsoft.public.dotnet.framework.aspnet)