ALSED32.EXE (Alternative Seek And Destroy for Windows 32 bit)

Copyright 2002, aa - aa@bitsmart.com, http://delphi.formasi.com

This is a windows program, runs only in windows (DOS box/console)
cannot run in plain DOS (16-bit) or MS-DOS mode.

usage:
Search and replace text or binary pattern in multiple, arbitrary files.

available options:
  /? or /h : help on usage
  /a : arguments check
  /b : make backup for altered file
  /d : retains file date/time of altered file
  /i : ignore case search
  /r or /s : recursive search onto subdirectory
  /n or /t : test-mode (don't actually proceed)

file search:
  Theoritically, You may specified the files to be searched
  as much as you wanted to, but actually it will be limited
  by command-line buffer (default is 128 bytes/chars in DOS)

  Anyway you may use the environtment variables via "SET" in
  the command prompt as:
    SET SEARCH=a*.txt b??.c d:\project\sample\*.pas (and so on...)

  Then you can execute program using environtment variable as:
    alsed32 %SEARCH%

  which then means:
    alsed32 a*.txt b??.c d:\project\sample\*.pas (and so on...)

  But I guess you will regularly execute this program as
    alsed32 /r *.asm *.c *.pas "this_proc" "that_proc"

  or even:
    alsed32 /s /i /t \*.* "his banner" "***MY BANNER***"

    (note the backslash preceding "*.*", this will alters-
    ANY files in your current drive, wouldn't work if current
    drive is where the "BigBoss" MS-Windows resides)

pattern:
  search pattern are either plain string or special characters
  escaped by "\", a pattern containing whitespaces (spaces or tabs)
  can be entered simply by surrounding pattern with double quotes,
  for other characters, especially ASCII special characters below 20H,
  you have to input them with escape character "\" followed by
  numeric representation of intended ASCII character.

  please note that "\" here behave slightly different compared
  with regex common syntax

  if "\" entered alone, it will be translated as "\", what else? :)
  any pair of contiguous "\" will be identified as a single "\",
  the extranouous "\", if exist, will then be added

  "\\a" means "\a"
  "\\a\" or "\\a\\" means "\a\"
  "\\a\\\" means "\a\\"
  "\\a\\\b\\\c\\\\\" means "\a\\b\\c\\\"

  if "\" followed by number(s) it will be interpreted with
  the corresponding ASCII character expressed by the number(s)
  please be careful, as the (not-so) intelligent match
  applied by this program might produced unexpected result

  "\13" resulting "[Carriage-Return]"
  "\13Test" resulting "[Carriage-Return]Test"
  "\130000" resulting "[ASCII-130]000"

  "\9" resulting "[TAB]"
  "\9Test" resulting "[TAB]Test"
  "\90" resulting "[ASCII-90]"
  "\900" resulting "[ASCII-90]0"

  As a rule of thumb, you should use full 3 digit numbers
  (preceded by zero if required), to avoid ambiguity
  for instance, to input a tab you should type them as: "\009"

  As an alternative, you may also use hexadecimal number
  of ASCII character, just remember that you MUST type
  EXACTLY 2 hex digits for this kind of notation.
  The hexadecimal notation is escaped by "\x" (or "\X")
  you can enter hexadecimal number in any case,
  "\x0D" or "\X0d" both interpreted as [Carriage-Return]

caveat:
  The plain S/R routine taken from Borland seems to be
  the main bottleneck here :(, when it's regarding to a big
  file (>2MB) containing many matches pattern (>1000 matches),
  it will down on her knees, for that reason, I refuse releasing
  the source code - until after I found the better algorithm