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 search_replace element is one of the top-level operation elements. It is used to perform a search and replace operation of a file on a file's contents.

The file child-element contains the filename.

The find child-element contains the string to be searched.

The replace child-element contains the replacement string.

The base attribute allows you to specify the directory in which the operation will be performed. For a better description, 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