velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Reid Thompson" <Reid.Thomp...@ateb.com>
Subject [Anakia newbie question] how to replace all custom tag occurrence?
Date Tue, 02 Oct 2001 12:01:23 GMT
write a script using sed  --- a search on the web for sed scripts will
prob find you one ( you may also find one for awk/gawk, or perl, etc)
--- you can then execute the script on your files ( write the script to
create the altered file as a tmp file then move the temp file to the
original)

http://www.dbnet.ece.ntua.gr/~george/sed/sedfaq.html

http://www.gnu.org/manual/sed-3.02/html_mono/sed.html


http://www.gnu.org  has online manuals for awk/gawk also


from the above listed faq page:
Sed reads its input from stdin (Unix shorthand for "standard
   input," i.e., the console) or from files (or both), and sends the
   results to stdout ("standard output," normally the console or
   screen). Most people use sed first for its substitution features.
   Sed is often used as a find-and-replace tool.

      sed 's/Glenn/Harold/g' oldfile >newfile

   will replace every occurrence of "Glenn" with the word "Harold",
   wherever it occurs in the file. The "find" portion is a regular
   expression ("RE"), which can be a simple word or may contain
   special characters to allow greater flexibility (for example, to
   prevent "Glenn" from also matching "Glennon").

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message