Removing paragraph

Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Jul 2007
Posts: 36
Reputation: abar_sow is an unknown quantity at this point 
Solved Threads: 0
abar_sow abar_sow is offline Offline
Light Poster

Removing paragraph

 
0
  #1
Sep 15th, 2007
For my proje i want to remove a unwanted paragraph in a text file. For example my text file may have acknowledgment in between sum useful data so i want to remove the acknowledgment paragraph fully...can anyone tel how to do tat
Last edited by abar_sow; Sep 15th, 2007 at 5:42 pm.
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 4,242
Reputation: peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of 
Solved Threads: 491
Moderator
Featured Poster
peter_budo's Avatar
peter_budo peter_budo is offline Offline
Code tags enforcer

Re: Removing paragraph

 
0
  #2
Sep 15th, 2007
Removing is the easy part you have to think about how you gone search/locate this unwanted part of text. What sort of criteria you will use? How you will handle your text, where you will get it from (user/file)?
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)

LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 36
Reputation: abar_sow is an unknown quantity at this point 
Solved Threads: 0
abar_sow abar_sow is offline Offline
Light Poster

Re: Removing paragraph

 
0
  #3
Sep 16th, 2007
Am taking Text files from the folder it may have sum 30 files.Consider the papers like ieee if am having acknowledgement in between abstract and sum other topic i want to remove the acknowledgement In my previous thread i removed a line but considering paragraph, I dont know where to stop ..Here we cant expect all text files topic in this order in tat case how it comes.For example

Abstract
Test managers often need to make an initial estimate of the number of people

Acknowledgement
Some of the material in this paper was developed by the participants

Introduction
Past tester to developer ratios are often useful for making rough estimates of required test
Last edited by abar_sow; Sep 16th, 2007 at 2:12 am.
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 4,505
Reputation: Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future 
Solved Threads: 521
Moderator
Featured Poster
Ezzaral's Avatar
Ezzaral Ezzaral is offline Offline
Industrious Poster

Re: Removing paragraph

 
0
  #4
Sep 18th, 2007
You'll have to read from one file and write what you want into another. As you scan your input, when you find line.startsWith("Acknowledgement") then keep reading lines but don't write any data until you get to the line.startsWith("Introduction").

I hope you aren't stripping copyrighted material of all copyright and acknowledegment info and presenting it for download though...
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 36
Reputation: abar_sow is an unknown quantity at this point 
Solved Threads: 0
abar_sow abar_sow is offline Offline
Light Poster

Re: Removing paragraph

 
0
  #5
Sep 18th, 2007
No its for my project as i said earlier, it may not contain useful information ....so I can do tat for only one file at a time.Or is there Options for doing multiple files
Last edited by abar_sow; Sep 18th, 2007 at 2:48 pm.
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 36
Reputation: abar_sow is an unknown quantity at this point 
Solved Threads: 0
abar_sow abar_sow is offline Offline
Light Poster

Re: Removing paragraph

 
0
  #6
Sep 19th, 2007
Locate the error plssssss

  1. import java.io.*;
  2. import java.io.BufferedInputStream;
  3. import java.io.BufferedOutputStream;
  4. import java.io.FileInputStream;
  5. import java.io.FileOutputStream;
  6. import java.io.IOException;
  7. import java.io.FilenameFilter;
  8. import java.io.File;
  9. import java.lang.*;
  10.  
  11. class FileWriteDemo
  12. {
  13. public static void main(String args[])throws IOException
  14. {
  15. FileReader fr = new FileReader("file3.txt");
  16. BufferedReader br = new BufferedReader(fr);
  17. String s;
  18. StringBuffer sr =new StringBuffer(br);
  19. while(sr=br.readLine())!= null)
  20. {
  21.  
  22. if(sr=="hi")
  23. {
  24. sr.delete(0,100);
  25. }
  26. }
  27.  
  28.  
  29. FileWriter f1= new FileWriter("file4.txt");
  30. String str1=sr.toString();
  31. f1.write(str1);
  32. f1.close();
  33. }
  34. }

error:
D:\program files\Java\jdk1.5.0\bin>javac FileWriteDemo.java
FileWriteDemo.java:19: illegal start of expression
while(sr=br.readLine())!= null)
^
1 error
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 4,505
Reputation: Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future 
Solved Threads: 521
Moderator
Featured Poster
Ezzaral's Avatar
Ezzaral Ezzaral is offline Offline
Industrious Poster

Re: Removing paragraph

 
0
  #7
Sep 19th, 2007
You are missing an open paren "(".
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Java Forum
Thread Tools Search this Thread



Tag cloud for Java
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC