PRODUCT |

|

|
|
|

|
|
|
|
|
|
|
|
|
FAQ |
|
|

|
|
|
|
|
|
|
|
|
|
LEARN SCRIPTING |
|
|

|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SAMPLE SCRIPTS |
|
|
|

|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
HELP / DOCUMENTATION |
|
|

|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|

|
|
|
|
|
Help Page - sen
( Some help pages may not display correctly in html because those help pages may have sample code in them, part of which may be mis-interpreted as html tags.
All help pages, including this help page, are available in biterScripting with the help command. )
|
|
|
Command
sen
Purpose
Editor - String enumerator or counter
Aliases
stringenumerator, strenum, sen
Syntax
sen [ <options> ] " ^ <search_string> ^ " <input_string>
Options
-c Case in-sensitive. Case will be ignored when searching for the
<search_string> in <input_string>. This option is very useful
when parsing links, emails, tags and commands in web pages.
For example, with this option, if the search string is "href=",
all the following search strings will be considered a match - "HREF=",
"HRef=", "href=". Without this option, case is considered
during the string search.
-r <search_string> is a regular expression. See help page on RE
for syntax of regular expressions.
Arguments
<input_string>
The input string on which this command will operate. It
can be specified as a str constant or str variable or an
expression resulting in a str value.
If a str constant is used, we highly recommend using
double quotes around it, such as "John Doe".
Without the double quotes, the spaces in the input string
will produce errors.
<search_string>
The string to search for. The input string will be searched for
this search string.
The <search_string> needs to be enclosed in carets (^).
If the <serach_string> itself contains a caret (^), an opening square bracket ([),
a closing square bracket (]) or a double quote ("), escape them with a backslash,
as \^, \[, \] and \". See help page on escape for more details.
If the -r option is specified, the <search_string> is assumed to be a regular
expression.
Stream Input
Stream input is ignored.
Stream Output
The number of string instances found are written here.
Stream Error
Any errors are listed here.
Description
The command enumerates (or counts) the instances of <search_string> in the <input_string>
and writes the count to output stream or redirected output stream.
The command CAN ALSO BE USED WITH FILES. Simply read in the contents of the file using
the repro command into a str variable, then use that str variable as <input_string>.
Restrictions
Valid Examples
var str content
repro "myfile.txt" >$content
sen "^2008^" $content
The above will count the number of times the string "2008" appears in file myfile.txt.
var str content
repro "myfile.txt" >$content
sen -r "^Copyright&2008^" $content
The option -r means we searching for a Regular Expression. & means any number (including 0)
of any characters. (See help page on RE.) The above will count the number of times the
copyright notice appears in myfile.txt.
Invalid Examples
sen "^2008^" myfile.cpp
Will produce 0. That's because myfile.cpp will be taken verbatim as
<input_string>, and there is no "2008" in that string.
See Also
systemvar
var
echo
escape
stex
sin
sap
sal
len
wen
chen
RE
|
|
|
© 2008-2010, biterScripting.com. All rights reserved.
biterScripting, biterScript, biterBrowser, biterScripting.com, FVA (Forward Variable Assignment) are trademarks of biterScripting.com. Is it biterScripting-compatible ? is a service mark of biterScripting.com.
Explorer, Unix, Windows are trademarks, service marks or other forms of intellectual property of their respective owners.
|
|