954,219 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Removing paragraph

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

abar_sow
Light Poster
36 posts since Jul 2007
Reputation Points: 10
Solved Threads: 0
 

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)?

peter_budo
Code tags enforcer
Moderator
15,436 posts since Dec 2004
Reputation Points: 2,806
Solved Threads: 901
 

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

abar_sow
Light Poster
36 posts since Jul 2007
Reputation Points: 10
Solved Threads: 0
 

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...

Ezzaral
Posting Genius
Moderator
15,985 posts since May 2007
Reputation Points: 3,250
Solved Threads: 847
 

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

abar_sow
Light Poster
36 posts since Jul 2007
Reputation Points: 10
Solved Threads: 0
 

Locate the error plssssss

import java.io.*;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.FilenameFilter;
import java.io.File;
import java.lang.*;

class FileWriteDemo
{
  public static void main(String args[])throws IOException
  {
	FileReader fr = new FileReader("file3.txt");
	BufferedReader br = new BufferedReader(fr);
	String s;
	StringBuffer sr =new StringBuffer(br);
	while(sr=br.readLine())!= null)
	{
          
		if(sr=="hi")
                 {
		   sr.delete(0,100);
		 }
       } 
	
 
   FileWriter f1= new FileWriter("file4.txt");
   String str1=sr.toString();
   f1.write(str1);
   f1.close();
  }
}


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

abar_sow
Light Poster
36 posts since Jul 2007
Reputation Points: 10
Solved Threads: 0
 

You are missing an open paren "(".

Ezzaral
Posting Genius
Moderator
15,985 posts since May 2007
Reputation Points: 3,250
Solved Threads: 847
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You