On 10 Jul 2009 at 22:34, Glen Johnson  wrote:

>     I desperately need a pointer to get me going on this.
>     We have a machine somewhere that has been sending tons of spam 
>     through our exchange server.
>     I stopped the smtp relay server before all of them got sent but 
>     now have a problem.
>     The outgoing queue has 4000 plus files that I need to either 
>     delete or move to a different folder based on the text in each 
>     file.
>     I tried using the dos find command but its output lists every 
>     file even if it doesn´t include the text.
>     So here is what I need.
>     Something that will search a file for a string, if the string is 
>     found, output the name of the file to a text file.
>     Then I can use the for command to move the file to a junk folder.
>     Run this a couple of times to get rid of the spam and what I have 
>     left are the legit emails that need to be processed.
>     Any help/suggestions/pointers 1appreciated.
>     Glen.

I would use a combination of SGREP and DOS FIND:

  sgrep  -fp "text to find" *.*| find "***FILE-NAME:">killfile.txt

killfile.txt will contain lines like the following:

***FILE-NAME: CIBOLA~1.PDF
***FILE-NAME: CORE-2~1.PDF
***FILE-NAME: CORE-2~2.PDF
***FILE-NAME: DS_SEA~1.PDF
***FILE-NAME: NEWEGG~1.PDF

which you can then parse using FOR.

Get sgrep here:
    http://www.cs.helsinki.fi/u/jjaakkol/sgrep.html

SGREP help page:
------- Included Stuff Follows ------- 
C:\Util\> sgrep
SGREP 2.5 (c) Copyright 1991,92 - California Software Design
Format:  SGREP [-flcxep] "target(s)" {...@]file(s)...}
  -f  display FILE-NAME for finds only    -l  line numbers
  -c  case sensitive search               -x  no logo
  -e  return errorlevel only              -p  pause when screen full
  -v  verbose output
  -o  write output into file SGREP.OUT
@file indicates an ascii file containing a file list to process

Hex byte sequences can be used to search for special non-displayable
characters.  They are specified using a pair of hexadecimal bytes
preceeded by a dollar sign,$.
EXAMPLES:  $23include is the string #include
           $252.50    is the string %2.50
           $23$24$25  is the string #$%
Two targets may be specified using the & and | characters to
search for two targets.  If the & is used the lines must contain
both targets.  If the | is used the lines must contain one of the
targets.
Example:   "save|main"  line must have save or main to be listed.
           "save&main"  line must have save and main to be listed.

--------- Included Stuff Ends ---------

--
Angus Scott-Fleming
GeoApps, Tucson, Arizona
1-520-290-5038
+-----------------------------------+




~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/>  ~

Reply via email to