<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 |
|
required, if inputFilePath is |
string on which to operate |
inputFilePath |
|
required, if inputString is |
file on which to operate |
outputFilePath |
|
required, if inputFilePath is not |
file which should contain the replaced text |
bufferSize |
|
512k |
size allocated to reader; may need adjusting if file is known to contain very long lines |
Elements
TAG |
TYPE |
COUNT |
DESCRIPTION |
---|---|---|---|
|
|
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 |
|
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 |
|
required |
the substring to search for (not a regex pattern!) |
with |
|
required |
what to replace it with |
Elements
None.
ReturnValues
None.
Examples
See above.