Manual Reference Pages  - columnadd (1)


columnadd - Adds multiple columns of [signed] integers, decimals, and times.


See Also


columnadd [options...]


columnadd adds columns of integers, decimals, and or times. Column positions must be set with spaces as tabs will not be expanded. There must be enough spaces between value columns so that the absolute value of the sum of the positive terms and the absolute value of the sum of the negative terms do not overflow into adjacent columns or off the front of the line. Numeric precision is limited only by the line length. The program does not operate correctly on numbers with exponents or with numbers that are not base 10.

columnadd accepts numeric formats:

columnadd accepts time formats:
[-]d hh:mm[:[ss[.c]]]

h,m,s may have only 2 digits. The maximum value in each case is 99 and this value will carry correctly. For instance, these are equivalent: 03:90:00 and 04:30:00.

d and c may have as many digits as will fit in the longest possible line, which is specified by -lw and is usually very large.

columnadd may be obtained as part of the drm_tools package from:


[none] Sum numeric values in columns. Read from stdin. Write to stdout. Accept times and negative values. Emit a sum at each blank line. Zero any column that is found to contain an illegal character, for instance, a letter.

-append OUTFILE
  Append output to OUTFILE. Default is to write to stdout.

-echo Echo input lines to the output. The default is not to echo input lines. Blank lines are normally replaced by a sum line, unless -nb is also specified, in which case the blank line is also echoed.

-h -help --help -? --?
  Print the help message. (Default - do not print help message.)

-i Emit version, copyright, license and contact information.( Default - do not emit information.)

  Read data from INFILE. If INFILE is - (a dash) or -in is not present on the command line then data is read from stdin.

-lw N Set the maximum line width. The default may be changed at compile time but is typically at least 16384. To see the default value use the -i option.

-nb Do not emit or zero sums at blank lines. Instead the entire input file is added with a single sum line emitted at the EOF. Note that a blank line is defined as one containing no characters other than the EOL character(s).

-nn No negatives, parse but do not sum negative numbers. Do not use with -np.

-np No positives, parse but do not sum positive numbers. Do not use with -nn.

-nt Disable time sums

-nz Do not zero a column on an illegal character. Can be used to continue addition in a sequence of values in a column like: 5, NA, -2. Without -nz the result is a blank space on the output line. With -nz the result is 3.
  Write output to OUTFILE. If OUTFILE is - (a dash) or -out is not present on the command line then data is written to stdout.

  Insert STRING at the beginning of each sum line.

-sr N Shift the input right N spaces. The default shift is 0. This option may be used to provide space at the front of the line so that the sum does not overflow leftwards off the front of the line. This is only sufficient to avoid a overflow if the data does not contain multiple independent columns of numeric data. If needed use extract or some other similar program to parse the input data and insert spaces between the data columns.






GNU General Public License 2


Copyright (C) 2006 David Mathog and Caltech.




David Mathog, Biology Division, Caltech <>

drm_tools columnadd (1) 1.0.2 OCT 23 2006
Generated by manServer 1.07 from /usr/common/man/man1/columnadd.1 using man macros.