Man page - pesubst(1)
Packages contains this manual
- bin2c(1)
- qplay(1)
- ssa2srt(1)
- clock_info(1)
- mod2opus(1)
- qtar(1)
- psthreads(1)
- pcmmix(1)
- pcmdiff(1)
- wktimer(1)
- rot13(1)
- bsvplay(1)
- logontime(8)
- pegrep(1)
- recursive_lower(1)
- checkbrack(1)
- aumeta(1)
- vcsaview(8)
- rezip(1)
- hxtools(7)
- peicon(1)
- hcdplay(1)
- mailsplit(1)
- pesubst(1)
- declone(1)
- ldif-duplicate-attrs(1)
- spec-beautifier(1)
- diff2php(1)
- ofl(1)
- fd0ssh(1)
- sourcefuncsize(1)
apt-get install hxtools
Manual
pesubst
NameSyntax
Description
Options
Modifiers
Examples
See also
Name
pesubst β perl-regexp stream substitution
Syntax
pesubst [ -f ] [ -s pattern ] [ -d pattern ] [ -m modifiers ] file ...
Description
pesubst can substitute strings in streams and files, and does so by using the Perl engine. It obsoletes sed(1) for simple substitution tasks.
Options
|
-f |
Fill the replacement string with NULs to bring it up to the size of the original string. |
-s pattern
Source pattern to search for in files. This can be any valid Perl regular expression. Files are slurped in as a whole, so matching across newlines should be no problem (with the -ms flag).
-d pattern
Destination (replacement) string. This can be any valid string Perl accepts. For details see the perlre (1) manpage.
-m modifiers
A string of modifiers to apply to the regex. See below.
Modifiers
|
e |
Evaluate the right side as an expression. |
||
|
g |
Replace globally, i.e., all occurrences. This is always enabled in pesubst. |
||
|
i |
Do case-insensitive pattern matching. |
||
|
m |
Treat string as multiple lines. That is, change "Λ" and "$" from matching the start or end of the string to matching the start or end of any line anywhere within the string. |
||
|
o |
Compile pattern only once. |
||
|
s |
Treat string as single line. That is, change "." to match any character whatsoever, even a newline, which normally it would not match. |
||
|
x |
Extend your patternβs legibility by permitting whitespace and comments. |
Examples
Change all occurrences of foo (case-insensitive) to bar:
pesubst -s foo -d bar -ms myfile
Change all Shell-style comments into C++ ones:
pesubst -s βΛ#β -d // -mm myfile
Using both the "m" and "i" flags:
pesubst -s βΛ#INCLUDE\s+β -d β#include β -mmi myfile.c
See also
hxtools (7), pegrep (1)