On Aug 19, Muthukumar said:
perl -ne 's/([a-z]\d+)/$1/g;' <filename>
If input is like the one below,
This23
is
a
45
good
thing
The result should be
This
is
a
45
good
thing
# perl -ne 'if ( ! /^\d+/ ) { s/[0-9]*$//;}print' test.log
That should be s/\d+$//, since \d is shorthand for [0-9] and there's no
point in match ZERO digits at the end of the string.
But I would just do:
$str =~ s/(?<=[a-zA-Z])\d+$//;
which removes digits at the end of a string IF AND ONLY IF they are
preceded by a letter.
--
Jeff "japhy" Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734 % the cheated, we who for every service
http://japhy.perlmonk.org/ % have long ago been overpaid?
http://www.perlmonks.org/ % -- Meister Eckhart
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>