#!/usr/bin/perl
use strict; # https://perlmonks.org/?node_id=11111508
use warnings;
open my $fh1, '<', \<<END;
ibl_ss_fuse_c0_r0/MRA_PVT_Tuning = 0x94,
ibl_ss_fuse_c0_r0/S3M_SPARE_1B7_3to7 = 0x0,
ON_DIE_FILLER/filler_fuse = 0x0,
ON_DIE_FILLER/filler_byte = 0x0,
END
open my $fh2, '<', \<<END;
die0_IAX_fuse_dino_c1_r0, die0_IAX_fuse_dino_c1_r0_IAX_fuse_iax_wr_ass
+ist_pulsewidth, 0x5,
die0_ON_DIE_FILLER, die0_ON_DIE_FILLER_ON_DIE_FILLER_filler_byte, 0xb,
die0_ON_DIE_FILLER, die0_ON_DIE_FILLER_ON_DIE_FILLER_filler_fuse, 0xa
END
my %values;
while( <$fh2> )
{
/([a-z][a-z_]*), (0x.),?$/ and $values{$1} = $2;
}
while( <$fh1> )
{
s!([a-z][a-z_]*) = \K(\w+)(?=,$)! $values{$1} // $2 !e;
print;
}
Outputs:
ibl_ss_fuse_c0_r0/MRA_PVT_Tuning = 0x94,
ibl_ss_fuse_c0_r0/S3M_SPARE_1B7_3to7 = 0x0,
ON_DIE_FILLER/filler_fuse = 0xa,
ON_DIE_FILLER/filler_byte = 0xb,
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.