GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
pesubst(1) hxtools pesubst(1)

pesubst — perl-regexp stream substitution

pesubst [-f] [-s pattern] [-d pattern] [-m modifiers] file...

pesubst can substitute strings in streams and files, and does so by using the Perl engine. It obsoletes sed(1) for simple substitution tasks.

-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.

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.

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

hxtools(7), pegrep(1)
2008-02-06 hxtools

Search for    or go to Top of page |  Section 1 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.