How to search and replace on multiple lines in multiple methods using perl?
Method1:
perl -i -pe 's/START.*STOP/replace_string/g' file_to_change
Method2:
perl -i -pe 'BEGIN{undef $/;} s/START.*STOP/replace_string/smg' file_to_change
Method3:
perl -0pe 's/search/replace/gms' file
Method4:
local $/ = undef;
open INFILE, $full_file_path or die "Could not open file. $!";
$string = <INFILE>;
close INFILE;
0 Comments:
Post a Comment
Note: only a member of this blog may post a comment.
<< Home