normal linux tool is not working with multiple line data extract and xml data.
have to create a java code to extract data i want.
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
public class Test {
/**
* @param args
* @throws IOException
*/
public static void main(String[] args) throws IOException {
File file = new File(args[0]);
BufferedReader br = new BufferedReader(new FileReader(file));
String line;
boolean print=false;
while ((line = br.readLine()) != null) {
if (line.equals("<WatchList>")){
print=true;
}
if(print){
System.out.println(line);
}
if(line.equals("</WatchList>")){
print=false;
}
br.close();
}
}
}
No comments:
Post a Comment