I am trying to write a script which will modified 4 lines in InI file :
Below is the content of my Ini file:
gEnableImps=1
gEnableBmps=1
gEnableSuspend=3
gDot11Mode=0
gEnableHandoff=0
gRoamingTime=0
Intf0MacAddress=000AF6798980
Intf1MacAddress=000AF5788981
Intf2MacAddress=000AF2898982
Intf3MacAddress=000AF5893983
InfraUapsdVoSrvIntv=0
InfraUapsdViSrvIntv=0
InfraUapsdBeSrvIntv=0
InfraUapsdBkSrvIntv=0
DelayedTriggerFrmInt=18000
gEnableFWRssiMonitoring=0
I have to modify below four line every day :
Intf0MacAddress=000AF6798980
Intf1MacAddress=000AF5788981
Intf2MacAddress=000AF2898982
Intf3MacAddress=000AF5893983
In above lines I need to change 6798980, 5788981,2898982,5893983 part I mean in each number any to consecutive digit should get change and the change digit should not get copy of another number i.e in each number unique digit should change.
Exp :
6798980 after change -> 6791280
5788981 after change -> 5783481
2898982 after change -> 2897682
I have written code but i am unable to change the number .. can any body give me some help
My Script:
#!/usr/bin/perl -w
use strict;
open(FH,"+<","WCN1314_qcom_cfg.ini")
or die "File not found";
my @lines=<FH>;
foreach my $line (@lines)
{
if(($line =~ /Intf0MacAddress/ ||$line =~ /Intf1MacAddress/||$line =~ /Intf2MacAddress/||$line =~ /Intf3MacAddress/) )
{
print "$line\n";
}
else
{
print "Not found\n";
}
}
I do not understand what you want to do with the numbers. Can you try to explain in detail? Are you sure your example is correct? Can you explain why some digits changed and some did not?
Anyway, you can use something like the following: