Data row/key count
aq_cnt [-h] Global_Opt Input_Spec Count_Spec Output_Spec
Global_Opt:
[-verb] [-stat]
Input_Spec:
[-f[,AtrLst] File [File ...]] -d ColSpec [ColSpec ...]
Count_Spec:
[-k KeyName ColName [ColName ...]]
Output_Spec:
[-kx|-kX[,AtrLst] File KeyName ColName [ColName ...]]
[-o[,AtrLst] File]
aq_cnt
counts and reports unique keys in a data set.
Since the program needs to store all the unique keys in memory in order to count them, its capacity is limited by the amount of physical memory in a machine. In case there is a capacity issue, an aq_pp and Udb combination can be used to implement a scalable key counting solution.
-verb
-stat
Print a record count summary line to stderr at the end of processing. The line has the form:
aq_cnt: rec=Count err=Count
-f[,AtrLst] File [File ...]
Set the input attributes and files. See the aq_tool input specifications manual for details.
Example:
$ aq_cnt ... -f,+1l file1 file2 ...
-d ColSpec [ColSpec ...]
Define the input data columns.
See the aq_tool input specifications manual for details.
In general, ColSpec
has the form Type[,AtrLst]:ColName
.
Supported Types
are:
S
- String.F
- Double precision floating point.L
- 64-bit unsigned integer.LS
- 64-bit signed integer.I
- 32-bit unsigned integer.IS
- 32-bit signed integer.IP
- v4/v6 address.Optional AtrLst
is a comma separated list of column specific attributes.
ColName
is the column name (case insensitive). It can contain up to
31 alphanumeric and ‘_’ characters. Its first character cannot be a digit.
Example:
$ aq_cnt ... -d s:Col1 s,lo:Col2 i,trm:Col3 ...
trm
attribute removes blanks around the value before it is converted to
an internal number.-k KeyName ColName [ColName ...]
KeyName
and its associated columns by ColNames
.
The key count will appear in the overall count summary (see -o).
KeyName
may be optionally preceeded by a wqy:
to indicate a
Web Query key. In this case, only one column is allowed in the key.
The value of the column will be automatically splitted at the ‘&’
separator; each of the resulting elements will be counted as as a key
value.-kx[,AtrLst] File KeyName ColName [ColName ...]
Define a key and its columns as in -k.
Additionally, output the unique key columns
to File
in this form:
"ColName","ColName",... ColVal,ColVal,... ...
See the aq_tool output specifications manual for details
on AtrLst
.
Note: If this option is given, overall count summary output will be suppressed unless -o is specified explicitly.
-kX[,AtrLst] File KeyName ColName [ColName ...]
Define a key and its columns as in -k.
Additionally, output the unique key columns and their occurrence count
to File
in this form:
"ColName","ColName",...,"Count" ColVal,ColVal,...,Num ...
See the aq_tool output specifications manual for details
on AtrLst
.
Note: If this option is given, overall count summary output will be suppressed unless -o is specified explicitly.
-o[,AtrLst] File
Set the output attributes and file for the overall count summary. The summary has this form:
"row","KeyName","KeyName",... Num,Num,Num,...
where “row” gives the row count and “KeyNames” (from -k, -kx and -kX) give their unique key counts.
See the aq_tool output specifications manual for details
on AtrLst
.
If this option is not given and there is no -kx or -kX option, a summary will be output to stdout by default.
Example:
$ aq_cnt ... -d s:Col1 s:Col2 ip:Col3 ... -k Key1 Col1 -kX File2 Key2 Col3 Col2 ... -o -
If successful, the program exits with status 0. Otherwise, the program exits with a non-zero status code along error messages printed to stderr. Applicable exit codes are: