Element: <search_replace>

Syntax

<!ELEMENT search_replace (file, find, replace)>
<!ATTLIST configure
          base           CDATA #IMPLIED>

This element occurs in : Element : <alfs> | Element: <stage>

See also : Element: <file> | Element: <find> | Element: <replace>

Description

The element search_replace is one of the top-level operation elements. It is used to perform a search and replace operation of a file.

The sub-element file contains the filename

The sub-element find contains the string to be searched

The sub-element replace contains the replacement string.

The attribute base specifies the directory in which the file replacement occurs. See Element : <base>.

Examples

<search_replace base="/usr/src/mypackage">
        <file>runit.sh</file>
        <find>BINDIR</find>
        <replace>/bin</replace>
</search_replace>

The equivalent bash script is :

echo Performing substitution in runit.sh
cd /usr/src/mypackage
cp runit.sh /tmp/foo.$$
sed -e 's/BINDIR/\/bin/' /tmp/foo.$$ > runit.sh