#!/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,

In reply to Re: Text file manipulation by tybalt89
in thread Text file manipulation by Sajn_00

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.