Michael Lamertz wrote: > > A. > perl -p0i -e 's/sub html_base.*//s' *.cgi > > reads the whole file in one
perldoc perlrun [snip] -0[digits] specifies the input record separator (`$/') as an octal number. If there are no digits, the null char acter is the separator. Other switches may precede or follow the digits. For example, if you have a version of find which can print filenames terminated by the null character, you can say this: find . -name '*.orig' -print0 | perl -n0e unlink The special value 00 will cause Perl to slurp files in paragraph mode. The value 0777 will cause Perl to slurp files whole because there is no legal character with that value. > (-0 means $/ = \000), \000 is a reference to a numeric literal, "\000" is the null character which doesn't "reads the whole file in one" > then the '/s' at the > end of the regexp treats the whole $_ that now contains the complete > file as a *single line*. > > Problems: > > -0 only works with text files, since binaries might contain 0-bytes. > use -00777 to be absolutely safe, since there's no character 256. Octal 0777 is not equal to 256. $ perl -le'print 0777' 511 > Due to the '/s' you can't match on beginning or end of line anymore. If you use the /m modifier then ^ will match the beginning of a line and $ will match the end of a line. John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]