Advertisement
Guest User

Untitled

a guest
Apr 18th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.35 KB | None | 0 0
  1. #!/usr/bin/env perl
  2. use strict;
  3. use warnings;
  4.  
  5. open my $fi, "<", "file.ini" or die "open error: $!";
  6. open my $fo, ">", "file2.ini" or die "open for output error: $!";
  7.  
  8. while(<$fi>) {
  9.         print $fo $_;
  10.         if(/^ComPort=(\d+)/i)
  11.         {
  12.           print $fo "EnableUSB=" . ($1 > 10 ? 1 : 0) . "\n";
  13.         }
  14. }
  15.  
  16. close $fo;
  17. close $fi;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement