xtnumber

Section: User Commands (1)
Updated: 2002-10-26
Index Return to Main Contents

 

NAME

xtnumber - number each record in sequential order

 

SYNOPSIS

xtnumber -a name of a new attribute [-k key attribute(s)] [-s order of attributes [%{n|r}]] [-S start number] [-I interval] [-B] [-q] [-i INPUT] [-o OUTPUT] [-z] [-t] [-T TEMP DIRECTORY]

 

DESCRIPTION

This command sequentially numbers the records with the same key value. If -k is not specified, all records are taken into account with the same key value. The sequential numbers will be stored in as a new attribute defined at -a. The starting value and the interval of the numbering sequence can be defined at the -S and -I argument. Sequential numbering for records with distinct key values classify them into numeric groups with the -B paramenter.

 

PARAMETERS

-k key attribute(s)
key attribute(s) which determines the key of an input file (when -k is omitted, all lines are assumed to take the same key value).
-s sort order of attributes
this determines the ordering of records with the same key value
start number (default value is 1).
-I interval
interval of sequential numbering (default value is 1).
-a new attribute
define name for the new attribute
-B sequential numbering for each distinct key
a sequential number is generated for each distinct key values.
-q sequential processing
when this option is used with the -k parameter, the command processes the input data in original sequence of the records, instead of sorting by the key attribute -k.

 

OPTIONS

-i input filename
if a suffix of the filename is '.gz', the command acts as a filter, extracting t he compressed file for processing. The command will read the file as standard in put when "-i" is not specified.
-o output filename
if a suffix of the filename is '.gz', the command automatically returns the outp ut data in zip archive. When "-o" is not specified, the result will sent to stan dard output.
-T temp file directory
the directory name for temporary files used in this command. -z zip archive compress the standard output to zip archive. When the option "-o" i s not given and "-z" is specified, the output will be compressed as zip archive.
-t plain text
treat the input and output data as plain text format.

Input file - dat.xt:

<field no="1">
<name>CustomerID</name>
</field>
<field no="2">
<name>Date</name>
</field>
<field no="3">
<name>TotalAmount</name>
</field>
</header>
<body><![CDATA[
A00004 20020214 365
A00004 20020415 4349
A00004 20020625 5268
A00004 20020810 1805
A00004 20021016 612
A00005 20020810 4554
A00005 20020923 491
A00005 20021016 3410
A00006 20020606 1364
A00006 20020810 2195
]]></body>

 

USAGE

Example 1. Sequentially number the records. e.g. xtnumber -a Number -i dat.xt -o rsl.xt Output file -rsl.xt
..
...
<field no="4">
<name>Number</name>
</field>
</header>
<body><![CDATA[
A00004 20020214 365 1
A00004 20020415 4349 2
A00004 20020625 5268 3
A00004 20020810 1805 4
A00004 20021016 612 5
A00005 20020810 4554 6
A00005 20020923 491 7
A00005 20021016 3410 8
A00006 20020606 1364 9
A00006 20020810 2195 10
]]></body>

Example 2. Number the records in sequential order for each date e.g. xtnumber -k Date -a Group -B -i dat.xt -o rsl.xt Output file -rsl.xt

<body><![CDATA[
A00004 20020214 365 1
A00004 20020415 4349 2
A00006 20020606 1364 3
A00004 20020625 5268 4
A00004 20020810 1805 5
A00005 20020810 4554 5
A00006 20020810 2195 5
A00005 20020923 491 6
A00004 20021016 612 7
A00005 20021016 3410 7
]]></body>

Example 2. Number the records in sequential order for each date starting from 10 in intervals of 5. e.g. xtnumber -k Date -a Group -S 10 -I 5 -i dat.xt -o rsl.xt Output file -rsl.xt

<body><![CDATA[
A00004 20020214 365 10
A00004 20020415 4349 10
A00006 20020606 1364 10
A00004 20020625 5268 10
A00004 20020810 1805 10
A00005 20020810 4554 15
A00006 20020810 2195 20
A00005 20020923 491 10
A00004 20021016 612 10
A00005 20021016 3410 15
]]></body>

 

SEE ALSO

For complete documentation and tutorial of xtnumber and other commands, please visit http://musashien.sourceforge.net

 

BUG REPORT

If you find a bug in xtnumber, please send an electronic mail to musashi@adm.osaka-sandai.ac.jp. Before sending a bug report, please verify that you have the lastest version of MUSASHI. Read this manual carefully to ensure the error is not caused by a quirk in the language.

 

AUTHORS

Yukinobu Hamuro, Naoki Katoh, Katsutoshi Yada, Stephane Cheung


 

Index

NAME
SYNOPSIS
DESCRIPTION
PARAMETERS
OPTIONS
USAGE
SEE ALSO
BUG REPORT
AUTHORS

This document was created by man2html, using the manual pages.
Time: 22:43:54 GMT, June 24, 2003