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
From:
anu p <[EMAIL PROTECTED]>
Date:
Thu, 18 Aug 2005 17:08:20 -0700 (PDT)
To:
[EMAIL PROTECTED]
To:
[EMAIL PROTECTED]
CC:
[EMAIL PROTECTED]

Hi,

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.

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
is
a
45
good
thing

The result should be

This
is
a
45
good
thing

Thamks,
Anupama.



__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

  
perl -pe 's/(\D+?)\d+/$1/g' <file>
That should work for your first problem.

Now the problem with your one liner ...
	perl -ne 's/([a-z]\d+)/$1/g;' <filename>

-n option won't print the output, you got to use -p instead

[a-z] range will match exactly one character, not a word

--
Get Thunderbird

Reply via email to