You can use the -0
switch to change the input separator:
perl -0777pe 's/foo
bar/FOO
BAR/' baz.txt
-0777
sets the separator to undef
, -0
alone sets it to
which might work for text files not containing the null byte.
Note that /m
is needless as the regex does not contain ^
nor $
.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…