perl -pi -e 'tr/a-zA-Z0-9//cd' file1
the above line was given by Uri Guttman (thanks!), for my initial
request for a-zA-Z0-9.
I need to modify the above line to suit my new requirements. Tried
reading up on the docs for perlop, especially tr, but i don't
understand it.
Any assistance is much appreciated!
Sent via Deja.com http://www.deja.com/
Before you buy.
You need to to be more specific about 'all punctuations'. Do you mean
ordinary English punctuation like ',.!:;?"', or symbols on your keyboard
('~`@/<>{}^'), or printable characters, or ...
> perl -pi -e 'tr/a-zA-Z0-9//cd' file1
>
> the above line was given by Uri Guttman (thanks!), for my initial
> request for a-zA-Z0-9.
Looks like you are almost there. Throw in the other characters you want
to purge form the file and you're done.
> I need to modify the above line to suit my new requirements. Tried
> reading up on the docs for perlop, especially tr, but i don't
> understand it.
If you read perlop and didn't understand parts of it, I am sure that the
folks who maintain the Perl documents would love to hear specific and
constructive criticism. (Such as: "I thought that 'perlop_sentence'
meant that I could write 'perl_statement' and get 'some_result', but
instead I get 'nother_result'.) If you read perlop and didn't
understand any of it, perhaps you should pick up a beginning Perl book
like Learning Perl (the Llama book). I skimmed through the section on
the transliteration operator (section 15.5) and found it to be easy
reading. If you expected perlop to tell you precisely how to do what
you want to do, perhaps you should ask your local mind-reader/Perl-guru.
:)
Jon
--