Files
thermo_sensor_v2/make_config.pl
T
2022-09-07 23:11:20 +03:00

27 lines
434 B
Perl

#!/usr/bin/perl
if (scalar(@ARGV) < 1)
{
die("Usage: make_config.pl SENSOR_NAME");
}
my $name = shift @ARGV;
Process("thermo_sensor_v2.things", $name.".things");
Process("thermo_sensor_v2.items", $name.".items");
sub Process
{
my $src = shift;
my $dst = shift;
my $fh;
open($fh, "< ".$src);
my $ofh;
open($ofh, "> ".$dst);
while (<$fh>)
{
$_ =~ s/SENSOR_NAME/$name/g;
print($ofh $_);
}
close($fh);
close($ofh);
}