Fwd: perl one liiner

2005-08-19 Thread anu p
Note: forwarded message attached. __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com ---BeginMessage--- Hi, I have written a perl one liner that gets rid of digits at the end of a word, but it

Re: perl one liiner

2005-08-19 Thread Muthukumar
perl -ne 's/([a-z]\d+)/$1/g;' filename It doesn't work, but if I use it in a script it works. I want to know where am I going wrong. Also I want to know how to not get rid of digits at the beginning of a line but the ones that follow some chars If input is like the one below, This23

Re: perl one liiner

2005-08-19 Thread Jeff 'japhy' Pinyan
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]

Re: Fwd: perl one liiner

2005-08-19 Thread John W. Krahn
anu p wrote: Hi, Hello, I have written a perl one liner that gets rid of digits at the end of a word, but it also gets rid of digits if they are at the beginning of a line. The one liner is perl -ne 's/([a-z]\d+)/$1/g;' filename It doesn't work, but if I use it in a script it works.

Re: Fwd: perl one liiner

2005-08-19 Thread Muthukumar
This should do what you want: perl -pe's/(?=[[:alpha:]])\d+//g' filename As per required ouput your one-line is showing to me as, # perl -pe 's/(?=[[:alpha:]])\d+//g' test.log This23 is a 45 good thing # try this one. # perl -pe 's/\d+//g if /^\D+/;' test.log This is a 45 good thing

Re: Fwd: perl one liiner

2005-08-19 Thread Binish A R
anu p wrote: Note: forwarded message attached. __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com Subject: perl one liiner