1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
<TITLE>NoSQL: Using NoSQL</TITLE>
<LINK HREF="NoSQL-4.html" REL=next>
<LINK HREF="NoSQL-2.html" REL=previous>
<LINK HREF="NoSQL.html#toc3" REL=contents>
</HEAD>
<BODY BGCOLOR="#fff0e0">
<A HREF="NoSQL-4.html">Next</A>
<A HREF="NoSQL-2.html">Previous</A>
<A HREF="NoSQL.html#toc3">Contents</A>
<HR>
<H2><A NAME="s3">3. Using NoSQL</A> </H2>
<H2><A NAME="sec-op-intro"></A> <A NAME="ss3.1">3.1 Operators </A>
</H2>
<P>The NoSQL system comprises a set of programs called Operators.
<P>Each operator is a separate program module that performs
a unique function on the data.
<P>At one time NoSQL used to have extra operators,
like <EM>body</EM>, <EM>dashline</EM>, etc. At some point I
realized how useless they were, so I dropped them. After all
they were just calls to ordinary
UNIX utilities. There was really no point in providing special
operators just for them, as their function could be done by applying
those system commands directly. For instance:
<P>
<DL>
<DT><B><B>body</B></B><DD><P>Same as : <CODE>tail +3 < table</CODE>
<P>
<DT><B><B>dashline</B></B><DD><P>Same as : <CODE>sed -n 2p < table</CODE>
<P>
<DT><B><B>headline</B></B><DD><P>Same as : <CODE>head -1 < table</CODE>
<P>
<DT><B><B>fieldsof</B></B><DD><P>Same as : <CODE>head -1 < table</CODE>
<P>
<DT><B><B>header</B></B><DD><P>Same as : <CODE>head -2 < table</CODE>
<P>
<DT><B><B>see</B></B><DD><P>Same as : <CODE>cat -vte < table</CODE>
<P>
</DL>
<P>Once again, this shows how powerful the UNIX operating system
already is of its own, and how handy it can be for an add-on
package like NoSQL to be able to tap into this power without
having to re-invent the wheel.
<P>Invoking NoSQL programs and operators is straightforward :
<P>
<BLOCKQUOTE><CODE>
<PRE>
command [options] [arguments]
</PRE>
</CODE></BLOCKQUOTE>
<P>where <CODE>command</CODE> is the name of the desired NoSQL
operator or utility. Make sure the directory containing the NoSQL
executables, usually /usr/local/nosql/bin/, is in your PATH.
<P>Most operators take a <CODE>--help</CODE> switch, that will show
the list of available command-line options and arguments, plus
some usage notes.
<P>Here follows a list of NoSQL operators, with a short description
of the function of each:
<P>
<DL>
<DT><B><B>addcolumn</B></B><DD><P>Create new empty columns in the
rightmost position of a table.
<P>
<DT><B><B>addrow</B></B><DD><P>Append a new empty record to a table.
<P>
<DT><B><B>column</B></B><DD><P>Pick columns by name, output columns in
listed order.
<P>
<DT><B><B>compute</B></B><DD><P>Compute an arbitrary expression using
column names.
<P>
<DT><B><B>depend</B></B><DD><P>Test for ``functional dependency'' betwen
two columns.
<P>
<DT><B><B>edittable</B></B><DD><P>Use an editor to allow modifications
to a table.
<P>
<DT><B><B>envtolist</B></B><DD><P>Convert environment variables into
a one-record list.
<P>
<DT><B><B>envtotable</B></B><DD><P>Convert environment variables into
a one-record table.
<P>
<DT><B><B>filter</B></B><DD><P>Run standard utilities against a table.
<P>
<DT><B><B>filetolist</B></B><DD><P>Convert a (possibly binary) file into
a one-record list.
<P>
<DT><B><B>gregorian</B></B><DD><P>Translate selected date columns from Julian
to calendar format.
<P>
<DT><B><B>index</B></B><DD><P>Generate table index files to be
used by 'search'.
<P>
<DT><B><B>islist</B></B><DD><P>Check whether an input file has
a valid 'list' format.
<P>
<DT><B><B>istable</B></B><DD><P>Check whether an input file has
a valid table format.
<P>
<DT><B><B>jointable</B></B><DD><P>Natural or "Master/Detail" join of
two tables on a common field.
<P>
<DT><B><B>julian</B></B><DD><P>Translate selected date columns from
calendar to Julian format.
<P>
<DT><B><B>justify</B></B><DD><P>An alias for prtable.
<P>
<DT><B><B>listtoform</B></B><DD><P>Take a file in 'list' format and
use the values from the last record to replace special
tags on a template file.
<P>
<DT><B><B>listtotable</B></B><DD><P>Take a file in 'list' format and
makes it into a table.
<P>
<DT><B><B>maketable</B></B><DD><P>Build a valid table header from a
template file.
<P>
<DT><B><B>number</B></B><DD><P>Insert a unique record identifier
into a table.
<P>
<DT><B><B>project</B></B><DD><P>An alias for column.
<P>
<DT><B><B>prtable</B></B><DD><P>Quick and easy table formatter for
character displays.
<P>
<DT><B><B>random</B></B><DD><P>pick one or more table records at random.
<P>
<DT><B><B>rename</B></B><DD><P>Rename a column.
<P>
<DT><B><B>repair</B></B><DD><P>Append empty data fields to rows to
make them match the table header.
<P>
<DT><B><B>rmcolumn</B></B><DD><P>Remove one or more columns.
<P>
<DT><B><B>row</B></B><DD><P>Select rows based on arbitrary AWK expressions.
<P>
<DT><B><B>search</B></B><DD><P>Select rows based on a multi-column key
of a sorted or indexed table.
<P>
<DT><B><B>select</B></B><DD><P>An alias for row.
<P>
<DT><B><B>sorttable</B></B><DD><P>Sort a table by one or more columns.
<P>
<DT><B><B>soundex</B></B><DD><P>Compute Knuth's soundex codes for
selected columns.
<P>
<DT><B><B>subtotal</B></B><DD><P>List subtotals of specified columns.
<P>
<DT><B><B>tabletoform</B></B><DD><P>Replace special tags in
a template file.
<P>
<DT><B><B>tabletolist</B></B><DD><P>Convert a table into the
corresponding 'list' format.
<P>
<DT><B><B>tabletorc</B></B><DD><P>Convert a table into rc(1) variable
assignments.
<P>
<DT><B><B>tabletosh</B></B><DD><P>Convert a single-record table
into sh(1) variable assignments.
<P>
<DT><B><B>template</B></B><DD><P>Build a table template file for
the input table.
<P>
<DT><B><B>union</B></B><DD><P>Concatenate multiple union-compatible tables.
<P>
<DT><B><B>unique</B></B><DD><P>Make a table unique on the primary key field.
<P>
<DT><B><B>update</B></B><DD><P>Insert/update/delete table rows based
on the contents of an edit table.
<P>
<DT><B><B>viewtable</B></B><DD><P>Visualize a table in a nice list-like format.
</DL>
<HR>
<A HREF="NoSQL-4.html">Next</A>
<A HREF="NoSQL-2.html">Previous</A>
<A HREF="NoSQL.html#toc3">Contents</A>
</BODY>
</HTML>
|