iFIRE.exe

Posted on March 28, 2008. Filed under: Tools |

Fed up with crashing Search and Replace tool from Funduc guys, I’ve written my own command line tool. S&R crashes when working on unicode files. I’ve written iFIRE tool to work on files with different encodings. You can specify search replace terms on command line, or write them all in a script file and pass that to the tool. If you want this tool, you can request me via mail narasimha (dot) vedala (at) gmail (dot) com

Below is the help output from the tool (format of the text sucks, sorry for that):

=========================================================

Fast Inline Re(gex)place Engine (iFIRE) [command line]
Performs a regular expressions search and/or replace in files.
Copyright (c) Narasimha Vedala 2008

iFIRE.exe [drive:][path]filename [/UNI | /CP:nnnn] [/CT:culturestring] [/NOCULTURE]  [/S:"<searchpattern>"] [/R:"<replacepattern>"] [/I] [/SL|/ML] [/O] [/Q][/SCRIPT:fullpath to script file] [/SCRIPTCP:nnnn - codepage of script file]

  [drive:][path]filename
              Specifies files to be searched and replaced.
  /?          Displays this help
  /S:         Regex search pattern. Refer to .NET documentation for regular expressions
              This option is ignored if /SCRIPT: file is specified
  /R:         Regex replacement pattern/string. Refer to .NET documentation
              This option is ignored if /SCRIPT: file is specified
  /I          Ignore case
  /UNI        Specifies that file given is in Unicode format (Little-Endian)
              This is same as specifying /CP:1200
  /CP:nnnn    Codepage (Encoding) of the file. Should be a valid codepage number supported by .NET
               Defaults to 1252 Western-European (Windows). See Quick Reference below.
  /CT:culture Culture info to be used by Regex
  /NOCULTURE  Regular expression search and replace is culture invariant
  /SL         Single line pattern matching. See .NET RegexOptions documentation
  /ML         Multiline pattern matching. See .NET RegexOptions documentation
  /O          Console output only.  File is not modified
  /Q          Quiet operation. No noise output to the console

  /SCRIPT:        Full path to Search and Replace script file
  /SCRIPTCP:nnnn  Search and Replace script file's codepage. For example:-
                  If script has Chinese Traditional characters, then specify /SCRIPTCP:950
                  Refer to .NET documentation for codepage numbers. Some are given below for reference
  Quick Reference:     name     --     culture     --  codepage
                  Portugues Brazil     -- pt-BR    --  1252
                  Chinese Simplified   -- zh-Hans  --  936
                  Chinese Traditional  -- zh-Hant  --  950
                  French (France)      -- fr-FR    --  1252
                  German (Germany)     -- de-DE    --  1252
                  Italian (Italy)      -- it-IT    --  1252
                  Japanese (Japan)     -- ja-JP    --  932
                  Korean (Korea)       -- ko-KR    --  949
                  Russian (Russia)     -- ru-RU    --  1251
                  Spanish (Spain)      -- es-ES    --  1252
                  English (US)         -- en-US    --  1252

  Script file: Writing script file is easy. Place each search replace term on single line as shown below. </CODE< p>

              [SEARCH -i]your search pattern here[REPLACE]your replace string/pattern here
              -i above means case-insensitive. It is optional. Comments start with // on new line.
  Usage Examples:
               iFIRE.exe C:\TEMP\TestFile.txt /script:"C:\TEMP\SearchReplaceScript.ifxr" /scriptcp:1252
               iFIRE.exe C:\TEMP\UnicodeTestFile.txt /CP:1200 /S:"Ifneon\s+Technologies" /R:"Infineon Technologies" /i
               iFIRE.exe C:\TEMP\UnicodeTestJapaneseFile.txt /uni /script:"C:\TEMP\SearchReplaceJPScript.ifxr"

/scriptcp:932 
 

Advanced Usage:
               Case insensitive search for some languages require culture [locale] information. You can provide it
               on the command line. Example assumes that replace script file has Japanese characters to be searched for.
               iFIRE.exe C:\TEMP\TestJapaneseFile.rc /cp:932 /ct:ja-JP /script:"C:\TEMP\SearchReplaceJPScript.ifxr" /scriptcp:932

Advertisements

Make a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Liked it here?
Why not try sites on the blogroll...

%d bloggers like this: