Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Output:my @flist = qw' 1st-device-CA_Eth.0/1 2nd-device-TX_Gig.1/1 '; print "@flist\n"; for my $file (@flist) { $file =~ s{\_[^_]+$}{, }; print "$file\n"; }
1st-device-CA_Eth.0/1 2nd-device-TX_Gig.1/1 1st-device-CA, 2nd-device-TX,
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: regex to rename last _ with ,
by choroba (Cardinal) on Sep 11, 2014 at 13:07 UTC | |
by ArifS (Beadle) on Sep 11, 2014 at 14:00 UTC | |
|
Re: regex to rename last _ with ,
by AnomalousMonk (Archbishop) on Sep 11, 2014 at 13:18 UTC | |
by ArifS (Beadle) on Sep 11, 2014 at 13:49 UTC | |
by AnomalousMonk (Archbishop) on Sep 11, 2014 at 14:39 UTC | |
by choroba (Cardinal) on Sep 11, 2014 at 14:43 UTC | |
by ArifS (Beadle) on Sep 11, 2014 at 15:07 UTC | |
by ArifS (Beadle) on Sep 11, 2014 at 14:58 UTC | |
|
Re: regex to rename last _ with ,
by Anonymous Monk on Sep 11, 2014 at 13:10 UTC | |
|
Re: regex to rename last _ with ,
by dmitri (Priest) on Sep 13, 2014 at 16:14 UTC | |
by AnomalousMonk (Archbishop) on Sep 13, 2014 at 17:28 UTC | |
by dmitri (Priest) on Sep 14, 2014 at 12:22 UTC | |
by AppleFritter (Vicar) on Sep 14, 2014 at 14:57 UTC | |
by Grimy (Pilgrim) on Sep 15, 2014 at 09:36 UTC |