in reply to deletion of one line of a particula pattern

while(<DATA>){ print "$1$/" if /\((E\d+)/; } __DATA__ ID:8F03F770.3E6A0B05.00000200.5E0263D7, (E00123), (E00540), (E00216), (E00313), (E00486), (E00112), (E00822), (E00792), (E00774), (E00623), (E00022), (E00188), (E00017), (E00075), (E00055), ID:500460E9.BB25AD46.00000200.3E044511,
Should do the trick...assuming all your desired values match E then a number of digits....

Replies are listed 'Best First'.
Re^2: deletion of one line of a particula pattern
by drock (Beadle) on Aug 23, 2004 at 20:06 UTC
    awesome... I wish I was better at reg exps. my only complaint is the output looks like:
    (E1234), E1234 (E4545), E4545
    instead of just
    Exxxx Exxxx Exxxx
      That's odd... can you provide the snippet of code that's producing that output?
        : )
        use strict; use diagnostics; my $log = qq(/usr/local/log/lvimg_Ldrive_tapes.log); my $out = qq(/usr/local/log/output); open (F, "$log") || die "could not open file:$!"; open (F2, ">$out") || die "could not open file:$!"; sub mytime { my ($month,$day,$year,$hours,$min) = (localtime)[4,3,5,2,1]; sprintf ("%02d/%02d/%02d %02d:%02d\n", $month+1,$day,($year % +100),$hours,$min); } my $tm = &mytime; print F2 "$tm\n"; while (<F>) { #if ($_ =~ /(E0+)/ ) { local $, = "\t"; print F2 +(split)[3], "$1$/" if /\((E\d+)/; #} } close (F); close (F2);