Initial commit: Backup der Webseiten
- zoesch.de - blitzkiste.net - gruene-hassberge (norbert.zoesch.de) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
39
zoesch.de/galerie/tools/replace_version.pl
Normal file
39
zoesch.de/galerie/tools/replace_version.pl
Normal file
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
####
|
||||
# Usage
|
||||
#
|
||||
# perl replace_version.pl --file=/path/to/file.php --version=2.8.0
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Getopt::Long;
|
||||
use File::Basename;
|
||||
|
||||
my %opt = ();
|
||||
GetOptions(
|
||||
\%opt,
|
||||
qw/
|
||||
file=s
|
||||
version=s
|
||||
/
|
||||
);
|
||||
|
||||
if (not -e $opt{file}) {
|
||||
die "file missing ".$opt{file};
|
||||
}
|
||||
|
||||
my $new_content = '';
|
||||
open(my $ifh, '<'.$opt{file}) or die 'Houston, problem with "'.$opt{file}.'" for reading';
|
||||
while (<$ifh>) {
|
||||
if (/^Version:/) {
|
||||
$_ = 'Version: '.$opt{version}.''."\n";
|
||||
}
|
||||
$new_content.= $_;
|
||||
}
|
||||
close($ifh);
|
||||
|
||||
open(my $ofh, '>'.$opt{file}) or die 'Houston, problem with "'.$opt{file}.'" for writing';
|
||||
print {$ofh} $new_content;
|
||||
close($ofh);
|
||||
Reference in New Issue
Block a user