|
|
|
||||||||||||||
|
|
![]() |
||||||||||||||
![]() |
|
||||||||||||||
| MultiSubLite is free for registered MultiSub users |
|
||||||||||||||
| MultiSubLite © 2006 A command line utility for batch Find/Replace Free to registered MultiSub users |
|||||||||||||||
|
|
|||||||||||||||
| MultiSubLite | ![]() |
|
|||||||||||||
| What is MultiSubLite? MultiSubLite is a companion to MultiSub, it is a 'lite' command line version suitable for use in batch scripts. It is very similar to the Unix tool 'sed'. Many users had asked whether MultiSub could be enhanced to support a command line mode, specifically for find/replace of text/file content. In response, MultiSubLite has been produced as a very small, compact, companion utility to MultiSub. Who can use it?
|
Looking for BLScanPlus? or MultiWord? |
||||||||||||||
|
|
|||||||||||||||
|
|
||||||||||||||
|
|
* Use MultiSub 'Lite' for command line batch Find & Replace * Find text from file contents * Replace text from file contents * Batch mode * Ideal for Web Designers * |
||||||||||||||
| MultiSubLite | What can MultiSubLite do? | ||||||||||||||
MultiSubLite supports the following functions;
|
|||||||||||||||
| MultiSubLite | How do I use it? |
||||||||||||||
| MultiSubLite
V1.1 is contained within the MultiSub\Program
folder for MultiSub V1.6 and above. This is free for registered
MultiSub users and is un-locked when MultiSub is un-locked. Usage; Long form;
multisublite
-filter filterstring | -input filename -recursesubfolders -find string | -findwithfile filename -replace string | -replacewithfile filename -ignorecase -ignorepatternwhitespace -insertbefore | insertafter -insertseparator msl-lf | msl-cr | msl-crlf -extension extensionstring -toscreen -overwrite -regex <regular expression options> (see below) -list -verbose Short form;
multisublite -fi filterstring | -i filename
-rsf -f string | -fwf filename -r string | -rwf filename -ic -ipw -ib | ia -is msl-lf | msl-cr |msl-crlf -e extensionstring -ts -o -re <regular expression options> (see below) -l -v Notes; 1. Strings, file paths or
filter strings containing spaces must be placed between
double quotes.
2. MultiSubLite does not make backup copies of input
files, always back up your files or work with copies of
your originals.
3. Strings containing
double quotes require double quoting e.g. "Hello World" should
be specified as ""Hello World""
4. When using regular
expressions, note that 'windows' files typically have a line
termination of \r\n. See the option -nocrlf.
5. In the text below user
parameters are denoted using the
standard
convention of <parameter>
(it is not necessary to include the <> characters).
-input (-i) <filename>
or
-filter (-fi) <filterstring>
- e.g. -filter "*.txt,*.php"
- A filter string cannot contain a folder path. -recursesubfolders (-rsf)
- Recursively traverse
the current folder
To check a filterstring,
use multisublite -filter filterstring with no other parameters on the
command line.
-find (-f) <string>
-replace (-r) <string>
-findwithfile (-fwf) <filename>
-replacewithfile (-rwf) <filename>
-ignorecase (-ic) - Specifies
case-insensitive matching.
-ignorepatternwhitespace (-ipw)
- Specifies that white
space is excluded from the find string.
-insertbefore (-ib)
- Inserts the replacement
text (before) rather than replacing.
-insertafter (-ia)
- Inserts the replacement
text (after) rather than replacing.
-insertseparator (-is)
<string> - Inserts a
separator string between find and replace text
if <string> = msl-lf inserts a LF (line feed) if <string> = msl-cr inserts a CR (carriage return) if <string> = msl-crlf inserts a CRLF (normal for windows)
-overwrite (-o)
- Do not prompt when
about to overwrite an existing file
- Warning: This permits overwriting
the input file(s)
-toscreen (-ts)
- Show changed text in
console
- This step occurs prior
to writing to file
-extension (-e)
<extensionstring>
- Output filename is the
input filename plus this extension
- e.g. an extension
string would typically be ".new"
-list (-l)
- Show number of
substitutions
-verbose (-v)
- Show number of
substitutions with
- File index of each, length of match and match number
-regex (-re)
- The 'find'
text is interpreted as a regular expression.
-ignorecase (-ic)
- Specifies
case-insensitive matching.
-ignorepatternwhitespace (-ipw)
-
Specifies that unescaped white space is excluded from the pattern and enables comments following a number sign (#).
-caretdollarmatchesinlinereturn (-cdmir)
- Changes
the meaning of ^ and $ so that they match at the beginning
and end, respectively of any line, not just the beginning/end
of the whole file or string.
-dotmatchesreturn (-dmr)
-
Specifies single-line mode. Changes the meaning of the period character (.) so that it matches every character (instead of
every character except \n).
-explicitcapture (-ec)
-
Specifies that the only valid captures are explicitly named or numbered.
-righttoleft (-rtl)
-
Specifies that the search moves from right to left instead of from left to right. The starting position should be
specified as the end of the string instead of
the beginning.
-compiled (-c)
- Specifies
that the regular expression will be compiled to an assembly. Generates MSIL code for the regular expression
this results in faster execution at the expense
of startup time.
-cultureinvariant (-ci)
- Specifies that
cultural differences in language is ignored.
-subcrlf (-s)
- Windows files use a line terminator of 'CRLF'
(\r\n). This option replaces \r\n for \n when reading the input file
and replaces \n for \r\n when saving the file. This allows the same
Regex expression to be used for MultiSubLite as can be used for the
MultiSub GUI version*.
* MultiSub reads input files into a text window,
this window strips the "\r\n" line termination characters and uses only
"\n". When writing files however, MultiSub will write out the file in
its original form. Since MultiSubLite has no text window, this
'stripping' of the line terminators does not occur, users may notice
that Regex expressions work differently between MultiSub and
MultiSubLite with regard to the line termination character(s). The
option "-subcrlf" forces
MultiSubLite to duplicate the line termination 'stripping' action of
MultiSub and thus allows Regex expressions (which involve the line
termination character(s)) to be truly equivalent between the two
platforms.I am always eager to make MultiSubLite better and better. So if there is a function you wanted that MultiSubLite does not support, contact me and I'll add it (for free). |
|||||||||||||||
|
|
|||||||||||||||
| Some example usage; Assuming MultiSub is installed in its regular location, change directory (cd) to the desired folder, then use command lines such as these below... "C:\Program Files\MultiSub\Program\MultiSubLite" -filter "*" -find string1 -replace string2 Will do a find/replace of string1 with string2 in all files contained within the current folder. "C:\Program Files\MultiSub\Program\MultiSubLite" -filter "*" -find string1 -replace string2 -recursesubfolders Will do a find/replace of string1 with string2 in all files contained within the current folder and all sub-folders below. "C:\Program Files\MultiSub\Program\MultiSubLite" -filter "*.txt" Shows the files that MultiSubLite will process with a filter of "*.txt", but does not make any changes. "C:\Program Files\MultiSub\Program\MultiSubLite" -input MyFile.txt -find "The Text" -replace "The new text" Does a find/replace of one string for another on a single file. "C:\Program Files\MultiSub\Program\MultiSubLite" -input MyFile.txt -find "The Text" -replacewithfile "My New Text.txt" Does a find/replace of a string for the contents of a file. "C:\Program Files\MultiSub\Program\MultiSubLite" -input MyFile.txt -findwithfile a.txt -replacewithfile b.txt Searches for the contents of file a.txt in file MyFile.txt, if found, replaces it with the contents of file b.txt. "C:\Program Files\MultiSub\Program\MultiSubLite" -filter "*" -find ABC -replace XYZ -extension ".new" Will do a find/replace of string1 with string2 in all files contained within the current folder, the output file names will be the same file names as the input files but with ".new" appended. "C:\Program Files\MultiSub\Program\MultiSubLite" -filter "*" -regex -find "^.*M" -replace "XYZ" -extension ".new" -ignorecase Will do a find/replace of string1 with string2 in all files contained within the current folder, the output file names will be the same file names as the input files but with ".new" appended. The find string is interpreted as a regular expression. The search is case insensitive. To substitute text containing double quotes, separate the text into sections and double quote the double quotes as follows; Is this the "real life", is this just "fantasy" becomes "Is this the """real life""", is this just """fantasy"" Note that you can just type multisublite rather than the full path, if you add the installation folder to your DOS path. |
|||||||||||||||
|
|
|||||||||||||||
| MultiSubLite | ![]() |
||||||||||||||
| This software is donationware and with no responsibility, accountability, liability or warranty of any kind regarding its usage or for any loss or damage that may result as a consequence of its use howsoever caused. By running this software the user accepts these terms of use. | |||||||||||||||
|
|
|||||||||||||||
| Back to top | |||||||||||||||
|
|
|||||||||||||||
|
|||||||||||||||
|
|
|||||||||||||||
|
|
|||||||||||||||