Click here to Skip to main content
15,892,537 members
Home / Discussions / Java
   

Java

 
AnswerRe: Is it a bug of featuer Pin
Manfred Rudolf Bihy18-Aug-12 2:11
professionalManfred Rudolf Bihy18-Aug-12 2:11 
AnswerRe: Is it a bug of featuer Pin
Gerben Jongerius18-Aug-12 2:12
Gerben Jongerius18-Aug-12 2:12 
AnswerRe: Is it a bug of featuer Pin
Eddy Vluggen18-Aug-12 2:28
professionalEddy Vluggen18-Aug-12 2:28 
AnswerRe: Is it a bug of featuer Pin
TorstenH.18-Aug-12 3:22
TorstenH.18-Aug-12 3:22 
AnswerRe: Is it a bug or featuere Pin
Gowtham Gutha15-Nov-12 7:25
Gowtham Gutha15-Nov-12 7:25 
Questionproblem while updating a file Pin
Namdeo Badhe17-Aug-12 7:07
Namdeo Badhe17-Aug-12 7:07 
Answerdouble post Pin
TorstenH.17-Aug-12 9:00
TorstenH.17-Aug-12 9:00 
Generalproblem while updating a text file in java Pin
Namdeo Badhe17-Aug-12 6:45
Namdeo Badhe17-Aug-12 6:45 
uppose i have a text file as data.txt has following content such as

12.12.12.12 "www.google.com"|"www.yahoo.com"|"www.rediffmail.com"
13.13.12.12 "www.yahoo.com"|"www.rediffmail.com"|"www.google.com"|"www.google.com"
14.14.12.12 "www.yahoo.com"|"www.rediffmail.com"|"www.yahoo.com"


i have another text file as token.txt has following content such as

"www.google.com" 100
"www.yahoo.com" 200
"www.rediffmail.com" 300


i want to make new file as result.txt that should contain the following data such as

12.12.12.12 100 200 300
13.13.12.12 200 300 100 100
14.14.12.12 200 300 200

my code is as follows




import java.util.*;
import java.io.*;

public class Remove
{
public static void main(String[] args) throws Exception
{
BufferedReader in=new BufferedReader(new FileReader(new File("C://find token//output.txt")));

PrintWriter out=new PrintWriter(new FileWriter(new File("C://find token//WASD.txt")));
//BufferedReader in=new BufferedReader(new FileReader(new File("C://find token//Nasa File Data//output.txt")));

//PrintWriter out=new PrintWriter(new FileWriter(new File("C://find token//Nasa File Data//WASD.txt")));

String str="";
while((str=in.readLine())!=null)
{
ArrayList<string> url=new ArrayList<string>();
String parts[]=str.split("\\s+");

BufferedReader in2=new BufferedReader(new FileReader(new File("C://find token//tokenfile.txt")));

String str2="";
//char []n= new char[27];
while((str2=in2.readLine())!=null)
{
String urltoken[]=str2.split("\\s+");
if(parts[1].indexOf(urltoken[0].toString())!=-1)

{
if(urltoken[1].toString()!=null)
url.add(urltoken[1].toString()+"?");

}

}

if(url.size()>0)
out.print(parts[0]+" "+" ");

//System.out.println(url.size());
for(int i=0;i<url.size();i++)
{
="" if(url.size()="">0)
{

out.print(url.get(i));


}}

in2.close();
url.clear();
out.println();
out.flush();
//}

}System.out.println("WASD is Created");
}
}
GeneralRe: problem while updating a text file in java Pin
Richard MacCutchan17-Aug-12 6:59
mveRichard MacCutchan17-Aug-12 6:59 
QuestionMessage Removed Pin
16-Aug-12 6:53
Member 936232116-Aug-12 6:53 
QuestionSwing Pin
Joshua Waring15-Aug-12 23:53
Joshua Waring15-Aug-12 23:53 
AnswerRe: Swing Pin
pasztorpisti16-Aug-12 0:28
pasztorpisti16-Aug-12 0:28 
GeneralRe: Swing Pin
Joshua Waring16-Aug-12 0:45
Joshua Waring16-Aug-12 0:45 
AnswerRe: Swing Pin
pasztorpisti16-Aug-12 0:55
pasztorpisti16-Aug-12 0:55 
GeneralRe: Swing Pin
Joshua Waring16-Aug-12 1:22
Joshua Waring16-Aug-12 1:22 
GeneralRe: Swing Pin
pasztorpisti16-Aug-12 1:50
pasztorpisti16-Aug-12 1:50 
GeneralRe: Swing Pin
Joshua Waring16-Aug-12 2:02
Joshua Waring16-Aug-12 2:02 
GeneralRe: Swing Pin
pasztorpisti16-Aug-12 2:12
pasztorpisti16-Aug-12 2:12 
GeneralRe: Swing Pin
Joshua Waring16-Aug-12 3:57
Joshua Waring16-Aug-12 3:57 
GeneralRe: Swing Pin
pasztorpisti16-Aug-12 4:08
pasztorpisti16-Aug-12 4:08 
GeneralRe: Swing Pin
Joshua Waring16-Aug-12 4:11
Joshua Waring16-Aug-12 4:11 
SuggestionRe: Swing Pin
pasztorpisti16-Aug-12 4:24
pasztorpisti16-Aug-12 4:24 
GeneralRe: Swing Pin
Joshua Waring16-Aug-12 2:13
Joshua Waring16-Aug-12 2:13 
SuggestionRe: Swing Pin
pasztorpisti16-Aug-12 1:00
pasztorpisti16-Aug-12 1:00 
AnswerRe: Swing Pin
Gowtham Gutha15-Nov-12 7:31
Gowtham Gutha15-Nov-12 7:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.