Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- use strict;
- use warnings;
- foreach my $fn (@ARGV) {
- my $ofn = $fn . '.new';
- open IN, '<', $fn
- or die "Cannot open " . $fn;
- open OUT, '>', $ofn
- or die "Cannot create " . $ofn;
- my $last_line = '';
- while(<IN>) {
- s/zorder="3"/zorder="11"/
- if $last_line =~ /\[water\]/;
- print OUT $_;
- $last_line = $_;
- }
- close IN;
- close OUT;
- rename $ofn, $fn
- or die "Could not replace " . $fn;
- }
Advertisement
Add Comment
Please, Sign In to add comment