Classic Information Retrieval/Handling Tool
Query
Possible commands
echo [-n] [ARG1 ... ARGn] //similar to Unix echo
pwd [DIR] //similar to Unix pwd
cd [DIR] //similar to Unix cd
cat [-removeHTMLmarks | -makeURLsVisible] [DOC1 ... DOCn] //similar to Unix cat
grep [OPTIONS] REGULAR_EXPR [DOC1 ... DOCn] //cf. Unix grep
fgrep [OPTIONS] STRING [DOC1 ... DOCn] //cf. Unix fgrep
diff [OPTIONS] [DOC1 ... DOCn] //cf. Unix diff
head [OPTIONS] [DOC1 ... DOCn] //cf. Unix head
tail [OPTIONS] [DOC1 ... DOCn] //cf. Unix tail
awk [-Fc] [prog] [parameters] [DOC1 ... DOCn] //cf. Unix awk
accessibleDocFrom [-maxlevel DIGIT] [-HTMLonly] [DOC1 ... DOCn] //similar to Unix find; default maxlevel: 1
count [-bytes] [-words] [-lines] [-paragraphs] [DOC1 ... DOCn] //similar to Unix wc
nbArguments [ARG1 ... ARGn] //count the number of arguments
run [DOC1 ... DOCn] //display and execute the commands which are in the documents
load [DOC1 ... DOCn] //execute the commands which are in the documents
call DOC1 [ARG1 ... ARGn] //call a CGI server or open a document (the GET method is used to send the arguments)
--- An useful combination:
accessibleDocFrom -maxlevel 1 -HTMLonly http:// | grep
================== Control structures ========================
COMMAND_RETURNING_SMALL_VALUES | COMMAND //commands like cd, cat, grep, awk and load may not be piped
if ( STRING_OR_NUMBER_COMPARISON ) { COMMANDS } [ else { COMMANDS } ] //op.: <, >, <=, >=, = (==), !=, !
while ( STRING_OR_NUMBER_COMPARISON ) { COMMANDS } //op.: <, >, <=, >=, = (==), != and !
do { COMMANDS } while ( STRING_OR_NUMBER_COMPARISON ) //op.: <, >, <=, >=, = (==), != and !
for VAR in ( WHITE_SEPARATED_STRINGS ) { COMMANDS }
for VAR in STRING { COMMANDS } //the different values in the string must be separated by spaces
set VARIABLE VALUE //set a variable; then, if prefixed by '$', this variable will be substituted by its value
Examples of queries and scripts
--- Select one here or copy/paste one below ---
Looking for a string in related documents
A loop
accessibleDocFrom -maxlevel 1 -HTMLonly
../kb/index.html
| grep -i knowledge
//''grep -i'' to search without regard to case
set a "1 2 3"; for i in $a { echo $i; };