Re: parsing

From: David Trimboli (trimboli_at_cshl.edu)
Date: 07/29/04

  • Next message: Matthias Tacke: "Re: parsing"
    Date: Thu, 29 Jul 2004 16:34:38 -0400
    
    

    "Québec" <Once@WasEno.ugh> wrote in message
    news:OATLPPYdEHA.2696@TK2MSFTNGP09.phx.gbl...
    > Hi gurus,
    >
    > I have a line of code here that works so so but I would like it to write
    the
    > name of the file in wich it found the word.
    > It search trough all files in a directory.
    >
    > type *.c| findstr assert >>Out.txt

    I find that when using findstr directly (without piping another command into
    it), and when the file parameter includes a wildcard, the command will tell
    me which file the match comes from.

        findstr assert *.c >>Out.txt

    This will produce a text file with a series of lines of this format:

        <filename>:<line containing match>

    If you want to list the files that match without actually listing the
    matching line itself, use this:

        for /f "delims=:" %%i in ('findstr assert *.c') do (echo %%i >>Out.txt)

    If you want to run this command directly on the command line and not in a
    script, change %%i to %i in both instances.

    David
    Stardate 4577.2


  • Next message: Matthias Tacke: "Re: parsing"

    Relevant Pages

    • Summary: Boot Error
      ... All Gurus: ... the correct response which is here: ... Probably the command '/usr/dt/bin/dtprintinfo -populate' is not working as ... and /etc/rc3.d to see if I could locate the "env" string to no avail. ...
      (SunManagers)
    • [HPADM] Changing Kernel Parameters in the command line.
      ... HP Gurus: ... I need to change a few kernel parameters like ... command lines. ... development servers. ...
      (HP-UX-Admin)
    • Re: find highlighted text (word 2007)
      ... You can certainly find highlighted text through the normal Find command, but I don't see a way to find only Yellow - though some of the Gurus may know a way to do it with code. ... Terry Farrell - MSWord MVP ...
      (microsoft.public.word.newusers)
    • Run a Java packaged inside a Jar
      ... I am new to Java and I am working on web services directly. ... quick question to you gurus. ... I want to run the command ... Prev by Date: ...
      (comp.lang.java.programmer)
    • Re: parsing
      ... >> Hi gurus, ... > I find that when using findstr directly (without piping another command ... Even good old find works well in this manner (for simple searches, ... and pick the one whose output format you find most convenient. ...
      (microsoft.public.win2000.cmdprompt.admin)