Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9121389
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T05:51:05+00:00 2026-06-17T05:51:05+00:00

I am trying to write a script which will modified 4 lines in InI

  • 0

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";
}
}  
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T05:51:06+00:00Added an answer on June 17, 2026 at 5:51 am

    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:

    #!/usr/bin/perl
    use warnings;
    use strict;
    
    my $file = 'WCN1314_qcom_cfg';
    open my $OLD, '<', "$file.ini" or die $!;
    open my $NEW, '>', "$file.new" or die $!;
    my $digit = 1;
    while (my $line = <$OLD>) {
        if (my ($num, $addr) = $line =~ /^Intf([0-3])MacAddress=000AF([0-9]+)/) {
            my @digits = split //, $addr;
    
            # Do what you need with the digits
    
            $line = "Intf${num}MacAddress=000AF" . (join q(), @digits) . "\n";
        }
        print {$NEW} $line;
    }
    close $NEW;
    close $OLD;
    
    if (-f "$file.bak") { unlink "$file.bak" or die "Cannot remove backup: $!"; }
    rename "$file.ini", "$file.bak"          or die "Cannot backup.";
    rename "$file.new", "$file.ini"          or die "Cannot create ini.";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to write a script which will count and erase empty lines
I'm trying to write a script which will read a file containing some urls
I'm trying to write a very lightweight build script which will basically just get
I am trying to write a Java program or Hadoop Pig script which will
I am trying to write a script which uploads a file via a html
I am trying to write a script which will automate a copy/paste of employee
I am trying to write a ruby script which will look in a directory
I am trying to write an php twitter script which will be run by
I'm trying to write a powershell script which will execute sqlcmd.exe to run a
I am trying to write an ant script which builds our project and will

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.