Grep: Search files in directory for string and log filenames to file

Grep: Search files in directory for string and log filenames to file

1
NewbieNewbie
1

    Nov 09, 2006#1

    Hi I'm trying to search a directory for files containing a specific string and log the path and filename that contain the search string to a new file. I'm trying to mimic the grep command in unix. Hope someone can help me.

    Thanks Val

    6,684586
    Grand MasterGrand Master
    6,684586

      Nov 09, 2006#2

      This thread is maybe helpful for you: equivalent to egrep ?? (extract line from big files)

      And here is a macro which uses FindInFiles to create a list of files in which the search string is found.

      The macro property Continue if a Find with Replace not found must be checked for this macro.

      It contains some extra code which are workarounds for known problems with Find In Files usage in a macro and should work for v10.20 and higher (tested with v11.20a and v12.20a+1). Since v12.00 the search result is a Unicode file which is detected by this macro and converted to an ASCII file to avoid some problems with Unicode files.

      Adapt the optional and required parameters of command FindInFiles to your need.

      InsertMode
      ColumnModeOff
      HexOff
      UnixReOff
      FindInFiles Recursive "Initial directory\" "file specification" "search string"
      Loop
      Find RegExp Up "%Search complete, found"
      IfNotFound
      NextWindow
      Else
      DeleteLine
      ExitLoop
      EndIf
      EndLoop
      Top
      HexOn
      Find "00"
      IfFound
      HexOff
      UnicodeToASCII
      Else
      HexOff
      EndIf
      Top
      Find "----------------------------------------^p"
      Replace All ""
      Find RegExp "%Find '*^p"
      Replace All ""
      Find RegExp "%Found '*^p"
      Replace All ""
      Find RegExp "/[0-9]+:*$"
      Replace All ""
      SortAsc IgnoreCase RemoveDup 1 -1 0 0 0 0 0 0
      Best regards from an UC/UE/UES for Windows user from Austria

      344
      MasterMaster
      344

        Nov 09, 2006#3

        Simply use "Find in Files" in the search menu. (I think it is F4 by default.)

        rds Bego
        Normally using all newest english version incl. each hotfix. Win 10 64 bit