in reply to Perl File Manipulation
(not tested){ local $/ = ""; # set to empty string -- see perldoc perlvar while (<>) { if ( /(\ncn: (\S+))\n(\S+)/ ) { my ( $cnline, $cnval, $nexttag ) = ( $1, $2, $3 ); if ( $nexttag ne "uid" ) { s/$cnline/$cnline\nuid: $cnval/; } } else { warn "Record $. has no cn value\n"; } print; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Perl File Manipulation
by wfsp (Abbot) on Jul 09, 2004 at 18:03 UTC | |
by graff (Chancellor) on Jul 09, 2004 at 22:20 UTC | |
by topperge (Initiate) on Jul 11, 2004 at 17:44 UTC | |
by graff (Chancellor) on Jul 12, 2004 at 02:00 UTC |