Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Modify a line following a target line?

by ccn (Vicar)
on Jan 05, 2009 at 21:38 UTC ( [id://734288]=note: print w/replies, xml ) Need Help??


in reply to Modify a line following a target line?

#!/usr/bin/perl -- use strict; use warnings; die "Usage: $0 filetoprocess\n" unless @ARGV; my %subst = ('C25' => 'SMS0011', 'U23' => 'TQF0022', # ... 'U25' => 'TQF1223', ); $/ = "\nI "; # use own input record separator while (<>) { # read a record and substitute if a ma +tch found if (my ($rd) = /REFDES=(\w+)/) { s/PKG_TYPE=(\w+)/PKG_TYPE=$subst{$rd}/ if exists $subst{$rd}; } print; }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://734288]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2024-04-25 17:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found