Package org.jppf.utils
Class FileReplacer
java.lang.Object
org.jppf.utils.FileReplacer
Utility to replace multiline content in text files.
This is the same kind of utility as the Ant "replace" task, except that it works.
- Author:
- Laurent Cohen
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classFile filter based on a set of extensions. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidMain entry point.voidreplace(NamedArguments args) Replace, in a set of specified files, a piece of text with another.
-
Constructor Details
-
FileReplacer
public FileReplacer()
-
-
Method Details
-
replace
Replace, in a set of specified files, a piece of text with another. The text can be multi-lines.- Parameters:
args- the parameters for searching, matching replacing.- Throws:
Exception- if an error occurs while performing the replacements.
-
main
Main entry point.The arguments must be specified as described in the clsss :
-i searchFile : the file containing the text to search for, can be multi-lines
-o replacementFile : the file containing the replacement text
-f rootDir : the root directory from which to search files recursively
-e extensions : a comma-separated list of file extensions, used as file filter; e.g. java,html,xml
-p : if specified then the program only shows matching files, but does not do any replacement
-r : if specified, then the text in the search and replacement files are interpreted as regex and replacement expressions- Parameters:
args- defines the text search, the text to replace it with, the file extensions to process, and whether changes are only simulated.
-