xtchgstr

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

 

NAME

xtchgstr - replacing strings characters

 

SYNOPSIS

xtchgstr -f attribute(s) -c replacement condition [-O EXCEPTION OUTPUT] [-F] [-A] [-i INPUT] [-o OUTPUT] [-z] [-t]

 

DESCRIPTION

xtchgstr replaces the character string in the attribute -f with a character string defined in the condition -c. Instead of replacing the string in place, the newly defined character string can be stored as a new attribute when the option -A is specified. Replacement condition is defined by pairs of character string and target character string to be replaced with.
Example: -c'BrandA:A,BrandB:B'
BrandA is replaced by A and BrandB is replaced by B. When the character string does not match with the condition defined in -c, it will be replaced by a null character (*) . You may replace null values by other characters with the option -O. If the attribute value does not match the replacement condition, you can use the option -F to leave it as the original value. Note that option -O and -F cannot be used at the same time. This command does not support partial match. Alternatively, xtsed can be used for replacing characters with partial match.

 

PARAMETERS

-f attribute(s)
character string attributes to to replaced
-c replacement condition
replacement condition (character string x:target character string to be replaced with)
-O character string for characters not satisfying the condition -c
Specify character string to be replaced with in place of null character when the attribute -f does not satisfy the condition -c.
-F
leaves the attribute as the original value when condition -c is not satisfied.
-A create a new attribute
create a new attribute for replacement strings. When -A is not specified, numerical values will be replaced by strings.

 

FILE 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.
-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
treat the input and output data as plain text format.

 

USAGE

Input file -dat.xt:
<body><![CDATA[
11
13
14
]]></body>

Example 1. Replace 2 digit category code 11 with bread and 13 with milk. e.g. xtchgstr -f CategoryCode2 -c 11:bread,13:milk -i dat.xt -o rsl.xt

Output - rsl.xt


<body><![CDATA[
bread
milk
*
]]></body>

Example 2. Replace 2 digit category code 11 with bread and 13 with milk, set other as undefined. e.g. xtchgstr -f CategoryCode2 -c 11:bread,13:milk -O undefined -i dat.xt -o rsl.xt

Output - rsl.xt


<body><![CDATA[
bread
milk
undefined
]]></body>

 

SEE ALSO

xtchgstr(1), xtsed(1) For complete documentation and tutorial of xtchgstr and other commands, please vis it http://musashien.sourceforge.net.

 

DIAGNOSTICS

When the character value to be replaced does not match the defined value in -c, it will be replaced by the null character (*).

 

BUG REPORT

If you find a bug in xtchgstr, 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 l anguage.

 

AUTHORS

Yukinobu Hamuro, Naoki Katoh, Katsutoshi Yada, Stephane Cheung


 

Index

NAME
SYNOPSIS
DESCRIPTION
PARAMETERS
FILE OPTIONS
USAGE
SEE ALSO
DIAGNOSTICS
BUG REPORT
AUTHORS

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