#!/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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |