reseqtable - resequence a numeric column in a table to a monotonicly ascending sequence
SYNOPSIS
reseqtale column
Assign new values to a column in a monotonicly ascending sequence
of integers. This is reminescant of the clasic BASIC command "renumber".
EXAMPLES
Fix up the "Number" column after selecting some records.
john@panic: row "X > 4" < input | reseqtable Number
reseqtalbe is a shell script which uses compute:
#!/bin/sh
#
# reseqtable
#
# Starbase Data Tables - An Ascii Database for UNIX
#
# copyright 1991, 1993, 1995, 1999 John B. Roll jr.
#
PATH=.:/bin:/usr/bin
export PATH
if [ $# != 1 ] ; then
echo "reseqtable <column>" 1>&2
exit 1
fi
Column=$1
compute -D " __ST=$Column
if ( $Column==__SN ) $Column = __NS
else $Column = ++__NS
__SN=__ST"