PRODUCT |

|

|
|
|

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

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

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

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

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

|
|
|
|
|
Help Page - wen
( 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
wen
Purpose
Editor - Word enumerator or counter
Aliases
wordenumerator, wordenum, wen, wc
Syntax
wen [ <options> ] <input_string>
Options
-e Count empty words. Without this option, empty lines are not considered.
-c Case insensitive. Case will be ignored when considering separator characters.
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.
Stream Input
Stream input is ignored.
Stream Output
The number of words found are written here.
Stream Error
Any errors are listed here.
Description
The command enumerates (or counts) words in the <input_string> and writes the count to the stream output
or redirected output target.
The following system variable plays an important role.
$wsep Word separator
This variable is used to identify, number, and extract distinct words.
See the 'systemvar' help topic for its description.
You can change its value to highly refine your search procedure.
We highly recommend that, if you change any system variable's value, you restore it
after the search is complete, as many system variables are often used by more than one command.
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>. Finally,
write the thus modified str variable back to the file.
Restrictions
None.
Valid Examples
Assume that you want to count words in a file myfile.js.
var str content
repro "myfile.js" >$content
wen -e $content
The above code will produce the number of all words (including empty words)
in file myfile.js.
To count just the non-empty lines, do NOT use the -e option, as follows.
wen $content
Invalid Examples
wen "myfile.js"
Will produce 1. That's because myfile.js will be taken verbatim as
<input_string>, and there is only one word in that string.
wen { repro "myfile.js" }
Will also produce erroneous results. The inline command { repro "myfile.js" }
will execute and bring out its output as part of the command line for wen.
The wen comand will then consider the first word of the output as <input_string>.
So, if the first word of myfile.js is empty, since we did not specify -e option,
the output of the wen command will be 0. If the first word of myfile.js is not
an empty word, the output of the wen command will be 1.
To correctly count the number of words in myfile.js, use the code listed
above under Valid Examples.
See Also
systemvar
var
echo
escape
wex
win
wap
wal
sen
len
chen
|
|
|
© 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.
|
|