<replace>

Purpose/Function

String replacement (à la Sed). Will accept either an input string or an input file. In the latter case, line-by-line streamed matching is done and the new lines are written to an output file, which must be specified (this can be the same as the input file; the overwriting is handled by making a temporary copy of the source).

Attributes

NAME

TYPE

DEFAULT VALUE

DESCRIPTION

inputString

java.lang.String

required, if inputFilePath is null

string on which to operate

inputFilePath

java.lang.String

required, if inputString is null

file on which to operate

outputFilePath

java.lang.String

required, if inputFilePath is not null

file which should contain the replaced text

bufferSize

int

512k

size allocated to reader; may need adjusting if file is known to contain very long lines

Elements

TAG

TYPE

COUNT

DESCRIPTION

<search-pair>

ncsa.tools.ogrescript.types.SearchPair

1:N

specifies the sequence to look for and the string with which it should be replaced

See below.

ReturnValues

DEFAULT NAME

TYPE

DESCRIPTION

replacedString

java.lang.String

string resulting from replacement (only relevant if inputString is used)

Examples

...
<replace inputFilePath="${wrf.namelist.template}" outputFilePath="${wrf.namelist}">
    <search-pair replace="Y1" with="${start.year}"/>
    <search-pair replace="M1" with="${start.month}"/>
    <search-pair replace="D1" with="${start.day}"/>
    <search-pair replace="H1" with="${start.hour}"/>
    <search-pair replace="Y2" with="${end.year}"/>
    <search-pair replace="M2" with="${end.month}"/>
    <search-pair replace="D2" with="${end.day}"/>
    <search-pair replace="H2" with="${end.hour}"/>
    <search-pair replace="RUNTIME" with="${forecast.time}"/>
</replace>
...    



ncsa.tools.ogrescript.types.SearchPair

<search-pair>

Purpose/Function

Describes a single replacement mapping.

Attributes

NAME

TYPE

DEFAULT VALUE

DESCRIPTION

replace

java.lang.String

required

the substring to search for (not a regex pattern!)

with

java.lang.String

required

what to replace it with

Elements

None.

ReturnValues

None.

Examples

See above.

  • No labels