Ask a Question related to PERL Miscellaneous, Design and Development.
-
bob #1
Removing numbers from a text file
What would be the most efficient way to remove numbers from a text
file.
eg. I want "abcde123fghi" to be "abcdefghi". Should load the file
into an array and create another file with characters that are not
numbers? With 100k character file for example that could take awhile.
Any suggestions?
thank you.
bob Guest
-
Removing street numbers
I have a list of street addresses 1670 Oak Ave 1423 Harvest Wood Circle 32 Oak Hills Plaza Estates 2341 Main And I want to create a... -
Text numbers for checks, etc.
Just ignore me if this has been gone over in depth before... Has anyone got a graceful calculation to turn numbers into their text equivalents... -
removing some text
Hello, I know nothing about perl but have a perl script that I need to modify. The line below removes all web links but leaves the text in the... -
Please help me with removing text
I have a logo from which I would like to delete the text. I would then like to copy the background to make it look like there was nothing there to... -
numbers to text
Anyone know of a class or function that converts numbers to readable text eg inputing the number would output text as in 120 = one hundred and... -
Martien Verbruggen #2
Re: Removing numbers from a text file
On 12 Sep 2003 19:42:25 -0700,
bob <utsuxs@hotmail.com> wrote:(untested)> What would be the most efficient way to remove numbers from a text
> file.
$ perl -pi -e 's/\d//g' filename
or
$ perl -pi -e 'tr/0-9//d' filename
There might be more efficient ways, but I don't think it's worth looking
for them, so I won't.
Why should it load the file into an array?> eg. I want "abcde123fghi" to be "abcdefghi". Should load the file
> into an array and create another file with characters that are not
> numbers?
100k is nothing. Why do you think that "could take awhile'? What do you> With 100k character file for example that could take awhile.
define as acceptible performance? I'm sure the above on a reasonable
machine with 100k of input would run more than fast enough. Loading a
100k into an array or scalar and then doing the same would not take much
more or less time. In any case, it's unlikely you'd notice the
difference.
Martien
--
|
Martien Verbruggen |
| The gene pool could use a little chlorine.
|
Martien Verbruggen Guest
-
bob #3
Re: Removing numbers from a text file
Martien Verbruggen <mgjv@tradingpost.com.au> wrote in message
Thanks for your tips. I'm brand new to perl and I've been and windoze> 100k is nothing. Why do you think that "could take awhile'? What do you
> define as acceptible performance? I'm sure the above on a reasonable
> machine with 100k of input would run more than fast enough. Loading a
> 100k into an array or scalar and then doing the same would not take much
> more or less time. In any case, it's unlikely you'd notice the
> difference.
>
> Martien
to long. I guess I've been corrupted.
bob Guest



Reply With Quote

