xtuniq

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

 

NAME

xtuniq - removes duplicated records

 

SYNOPSIS

xtuniq -k key attribute(s) [-q] [-i INPUTFILE] [-o OUTPUTFILE] [-z] [-t] [-T WORKFILE DIRECTORY]

 

DESCRIPTION

xtuniq removes records with duplicate key attributes to create a unique key value. When -k is not specified, the last record in the data will be selected.

 

PARAMETERS

-k key attribute(s)
the attribute(s) for creating a unique key
-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 attribut e -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 working directory
specify the directory name for temporal files used in this command.
-z zip archive
compress the standard output to zip archive. When the option "-o" is not given a nd "-z" is specified, the output will be compressed as zip archive.
-t plain text
xtagg treats the input and output data as plain text format.

 

USAGE

Input file - ref.xt:

<field no="1">
<name>CustomerID</name>
</field>
<field no="2">
<name>Date</name>
</field>
<field no="3">
<name>TotalAmount</name>
</field>
<field no="4">
<name>TotalQuantity</name> </field>
</header>
<body><![CDATA[
A00004 20020214 1 365
A00004 20020415 9 4349
A00004 20020625 13 5268
A00004 20020810 5 1805
A00004 20021014 2 612
A00004 20021016 11 3410
A00005 20020918 12 4554
A00005 20020923 1 491
A00056 20021128 1 94
A00056 20021128 1 112
A00056 20021128 1 115
A00056 20021128 1 93
A00056 20021128 1 149
A00131 20020108 2 280
A00120 20020727 1 85
A00120 20020727 1 68
A00120 20020727 1 112
A00120 20020727 1 69
]]></body>

Example 1. Find out the list of customers who have made a purchase. e.g. xtuniq -k CustomerID -i dat.xt -o rsl.xt Output file -rsl.xt

<body><![CDATA[
A00004 20020214 1 365
A00005 20020918 12 4554
A00056 20021128 1 94
A00120 20020727 1 85
A00131 20020108 2 280
]]></body>

Example 2. Find out the list of customers who have made a purchase in sequential order. e.g. xtuniq -k CustomerID -q -i dat.xt -o rsl.xt Output file -rsl.xt

<body><![CDATA[
A00004 20021016 11 3410
A00005 20020923 1 491
A00056 20021128 1 149
A00131 20020108 2 280
A00120 20020727 1 69
]]></body>

Example 3. Find out the dates each customer visits the store.
Since a customer will most likely to purchase more than one item for each visit, there will be multiple transaction lines with the same date for each customers. xtuniq removes the duplicates and select one unique purchase date for each customer with key field customer and date. e.g. xtuniq -k customerID,date -i dat.xt -o rsl.xt Output file -rsl.xt

<body><![CDATA[
A00004 20020214 1 365
A00004 20020415 9 4349
A00004 20020625 13 5268
A00004 20020810 5 1805
A00004 20021014 2 612
A00004 20021016 11 3410
A00005 20020918 12 4554
A00005 20020923 1 491
A00056 20021128 1 94
A00120 20020727 1 85
A00131 20020108 2 280
]]></body>

 

DIAGNOSTICS

As an important precaution, the key field must be sorted in ascending order before running xtuniq to properly return the unique value.

 

SEE ALSO

xtagg(1), xtbest(1) For complete documentation and tutorial of xtuniq and other commands, please visit http://musashien.sourceforge.net

 

BUG REPORT

If you find a bug in xtuniq, 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
DIAGNOSTICS
SEE ALSO
BUG REPORT
AUTHORS

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