
command-definition.sed.html Maven / Gradle / Ivy
Sed is a stream editor. A stream editor is used to perform basic text
transformations on an input stream (a file or input from a pipeline).
While in some ways similar to an editor which permits scripted edits
(such as ed), sed works by making only one pass over the input(s),
and is consequently more efficient. But it is sed's ability to filter
text in a pipeline which particularly distinguishes it from other
types of editors.
NOTES
- Currently only the substitute "s" command is supported.
- Currently only the forward slash "/" can be used as the script delimiter. e.g. s/search/replace/g
- A forward slash can be used in the search or replace expression, escaped with a backslash.
- The g option can be used at the end of the script to denote whether substitute is replace first or replace all per line.
Some examples:
input day into sed("s/day/night/") This will output "night"
input "day and night" into sed("s/\\sand\\s/-to-/") This will output "day-to-night"
(Note the use of \s whitespace character).
Java regular expressions are used for searching and replacing. For an
overview of the Java pattern matching, and substition, please see the
{@link java.util.regex.Pattern} documentation.
© 2015 - 2025 Weber Informatics LLC | Privacy Policy