psReplaceStrings

Description

     This program replaces all instances of 'old string' with 'new string' in <file>.
This program also backs up the original file to <file.old>.  You can specify an old
and new string pair on the command line, or specify a file which contains old and new
string pairs.

 

Syntax

psReplaceStrings -Ifile -Nnew_file
-Sold_string -snew_string
-Pstring_pairs_file
-Ooptions -Flog_file

 

Arguments

-I

Name of input file

-N

Name of new file [-I]

-P

Name of old-new strings pairs file

-S

Old string

-s

New string

-F

Output log of messages [standard output]

-O

Options

 

Options

i

The old string must be surrounded by white spaces in the original text.

d

If the old string exists on the line, delete the entire line.

w

Keep leading and trailing whites spaces on old and new strings.

 

Environment Variables Behind the Scenes

PS_SYSMSG_FILE

For the location of the system-wide messages file.

 

Notes

     The format of the strings pairs file is very simple.   It has three
columns.  Each column is separated by one or more white spaces.   The first
column contains the old string.  The second column contains the new string.
The third column contains either 'D' which means to delete the line if
old string is found, 'Y' which means the old string must be surrounded by
white spaces for a match, or 'N' which means the old string does not have
to be isolated by white spaces.   Look in the source directory for this program
to see an example strings pairs file.
     You do not have to use a strings pairs file.  You can specify a single pair of
strings on the command line using the -S and -s arguments.   The advantage of using
a strings pairs file is that you can specify up to 2000 pairs in a single file,
with which psReplaceStrings in one pass, can change all the old string to new
strings in your input file.

 

Go to DBPowerSuite 7.9 List of Programs.


Updated: Thu Jun 18 21:12:26 2009