Last modified: December 2022

URL: https://cxc.cfa.harvard.edu/ciao/ahelp/stk_count.html
AHELP for CIAO 4.17

stk_count

Context: Tools::Stacks

Synopsis

stk_count is used to count the number of items in a stack. The output is to the stk_count parameter file.

Syntax

stk_count infile [count] [echo] [verbose]

Description

The stk_count program takes an infile string as input. The infile string can be defined in any variation that is accepted by the ASCDS stack API. These variations include the use of @ and added directory paths (ie. @/tmp/foo).

The output parameter is count. Count will hold the number of elements found in the stack defined by infile.

The level of verbosity is defined by the verbose parameter. The user can optionally set verbose from 0 (for not output) up to 3 (for the most output.)


Examples

Example 1

stk_count infile="one two three"

stk_count will build a stack from the string infile string "one two three" and output the number of items in the stack. In this case the number of stack items is 3.

Example 2

stk_count infile="@file.lis foo"

stk_count will build a stack from the string infile string "@file.lis foo" and output the number of items in the stack. If file.lis contains 5 lines, the number of stack items will be 6.

Example 3

stk_count infile="foo @/tmp/file.lis goo"

stk_count will build a stack from the string infile string "foo @file.lis goo" and output the number of items in the stack. If /tmp/file.lis contains 10 lines, the number of stack items will be 12.


Parameters

name type ftype def min max reqd stacks
infile file input       yes yes
count string         no  
echo boolean   no     no  
verbose integer   0 0 5 no  

Detailed Parameter Descriptions

Parameter=infile (file required filetype=input stacks=yes)

The string used to build a stack.

The infile string can be defined in any variation that is accepted by the ASCDS stack API. These variations include the use of @ and added directory paths (ie. @/tmp/foo). Zero or more stacks may be used as input.

Parameter=count (string not required)

This is the tool output. Count holds the total number of elements derived from the infile parameter.

Parameter=echo (boolean not required default=no)

Echo value to screen?

Determines if the retrieved value is printed to the screen in addition to being stored in the parameter file.

Parameter=verbose (integer not required default=0 min=0 max=5)

Determines the level of output the user will see when the program is run.

Each level adds additional output. 0 - no output. 1 - shows non-hidden parameters. 2 - shows hidden parameters. 3 - gives the user information about which stage of the program is executing.


Bugs

There are no known bugs for this tool.

See Also

concept
stack
tools::stacks
stk_build, stk_read_num, stk_where