40 lines
493 B
Perl
Executable File
40 lines
493 B
Perl
Executable File
#!/usr/bin/perl
|
|
|
|
|
|
# *Rewrites* files:
|
|
#
|
|
# % some string \
|
|
# % other string
|
|
#
|
|
# ===>>
|
|
# % some string other string
|
|
|
|
use warnings;
|
|
use strict;
|
|
|
|
my $file = $ARGV[0];
|
|
|
|
open(FH, '<', $file) || die "open $file: $!";
|
|
my @lines = <FH>;
|
|
close(FH);
|
|
|
|
open(FH, '>', $file) || die "open $file: $!";
|
|
my $concat = 0;
|
|
foreach (@lines) {
|
|
|
|
if ($concat) {
|
|
s/^\s*%/ /;
|
|
}
|
|
|
|
if (s/\\+$//) {
|
|
chomp;
|
|
$concat = 1;
|
|
} else {
|
|
$concat = 0;
|
|
}
|
|
|
|
print FH;
|
|
}
|
|
close(FH);
|
|
|