.Dd September 8, 1996 .Dt COUNT 1 .Os NetBSD 1.2BETA .Sh NAME .Nm count .Nd counting utility .Sh SYNOPSIS .Nm .\" What I want is... .\" .Op Ar keyword Ar value Op Ar keyword Ar value ... .\" but that runs into a number-of-arguments limit, and using .Xo/.Xc .\" doesn't work with .Op. So.... .Bo .Ar keyword .Ar value .Op Ar keyword Ar value ... .Bc .Sh DESCRIPTION .Nm counts. The keyword-value pairs allow specifying many aspects of the counting operation; the allowed keywords are: .br .Bl -tag -width "postfix" -compact -offset indent .It from The number to start counting at. .It to The number to stop counting at. .It by The increment between numbers. .It pad The width to pad the numbers to (pad with spaces). .It 0pad The width to pad the numbers to (pad with zeroes). .It base The base to count in. .It prefix A string to print before the numbers. .It postfix A string to print after the numbers. .El .br All of these have defaults. The defaults are usually sensible; specifically, the following rules are used to supply any missing values: .Bl -bullet -offset indent .It If no .Ar start value was given, then if either .Ar by or .Ar stop was given with a negative value, then the starting value is \-1, otherwise it's 1. .It If no .Ar by value was given, then if a .Ar stop value was given and its value is less than the (possibly defaulted) starting value, the increment is \-1, otherwise it's 1. .It If no padding .Pf ( Ar pad or .Ar 0pad ) was specified, no padding is provided; the effect is as if .Sq "pad\ 1" were specified. .It If no .Ar prefix is specified, a zero-length string is used as the prefix. .It If no .Ar postfix is specified, a single newline is used as the postfix. (Note that specifying a .Ar postfix overrides this default; if you want a newline, you must specify it.) .It If no .Ar base is specified, the default is 10. .El Any numeric .Ar value s may be given in binary, octal, decimal, or hex. If the first two characters of the number are 0b or 0B, the number is in binary; if 0o or 0O, the number is in octal; if 0t or 0T, decimal; if 0x or 0X, hex. Otherwise, the number is in decimal, unless it has a leading 0, which indicates octal. .Pp String values are examined for \e escapes. If the character following the \e is one of abefnrt, the two-character sequence is replaced with a bell, a backspace, an escape, a form-feed, a newline, a carriage-return, or a tab, respectively. If the following character is an octal digit, then a string of up to three following octal digits is taken to specify a character code. If the following character is an x or X, a string of hex digits of unlimited length is taken to specify a character code. Otherwise, the \e is removed and the following character is retained. .Pp If the .Ar start and .Ar stop values are equal, only one number is printed. .Pp If the .Ar by value is zero, the result is an infinite loop, unless the previous paragraph applies. .Pp There are probably bugs lurking around the use of the most negative integer on two's-complement architectures; it's best to avoid it. .Sh BUGS There is no way to follow a \ex escape with one of the twelve characters 01234567abef, short of assuming the character code of the desired following character, since without a \e the following character will be taken as another hex digit, and with a \e the following character will be taken as an escape in its own right. (C, from where the \ex syntax was borrowed, gets around this by concatenating adjacent string literals, something that makes no sense here.) .Sh AUTHOR der Mouse, .Aq mouse@rodents.montreal.qc.ca .