import java.io.*;
class Automation1 implements Runnable
{
int iterationCount=0;
Thread t;
FileReader fr;
//FileWriter fw;
BufferedReader br;
//BufferedWriter bw;
public Automation1()
{
t = new Thread(this,"New Thread");
t.start();
}
public static void main(String args[])
{
new Automation1();
}
public void func()
{
int i,x=0;
i=1;
boolean ifFound = false;
String str="" , append="";
try
{
//fw = new FileWriter("C:/Gaurav/Java_Classes/output.doc");
fr = new FileReader("C:/Documents and Settings/Administrator/Desktop/exprep.log");
br = new BufferedReader(fr);
//bw = new BufferedWriter(fw);
while((append = br.readLine()) != null)
{ //str=str+append;
x=append.toLowerCase().indexOf("verified successfully.");
//System.out.println("I am here only");
if(x >= 0)
{
//System.out.println("I am finally inside if loop");
System.out.println("Export Process Successful");
ifFound = true;
break;
}
i++;
}
//bw.write(str2);
//System.out.println(str2);
//System.out.println(str.substring(0,10));
System.out.println("Value of x is :"+ x);
//System.out.println("Value of y is :"+ y);
if(!ifFound)
System.out.println("Export process failed");
fr.close();
br.close();
}
catch(StringIndexOutOfBoundsException s) {}
catch(FileNotFoundException ae) {}
catch(NullPointerException npe) {}
catch(IOException e)
{
System.out.println(e);
}
System.out.println(i);
iterationCount++;
}
public void run()
{
while(iterationCount != 1)
{
try
{
func();
Thread.sleep(10);
}
catch (InterruptedException ie)
{
System.out.println(ie);
}
}
}
};
I am trying to find the string "verified successfully" in a log file using the above program.... but i am not able to do that. can someone please suggest what i need to do....
can anyone send me the code please its really urgent
i am struggling with this
quick response will be highly appreciated
In my next post i will be pasting the log file