Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Take numbers out of a Text File

794113Feb 17 2010 — edited Feb 17 2010
Hi,

I have a text file and its contents look like this:
Congress	NNP	I-NP
September	NNP	B-NP
2009	CD	I-NP
skip	NN	B-NP
to	TO	B-PP
-----
etc
-------
I want to delete the lines of the text file which contain a number in the beginning. So, in the third line whenever I can see 2009 I will simply remove that line from my text file.
So, new text file will have in contents:
Congress	NNP	I-NP
September	NNP	B-NP
skip	NN	B-NP
to	TO	B-PP
How to do this using a Java code? Should Regex be a solution to this?

Please help.

Thanks in advance
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 17 2010
Added on Feb 17 2010
8 comments
225 views