long maxsize = 1024l * 1024 * 1024 * 100;
for (FileStatus f : filelist) {
if (!f.isDir() && !f.getPath().getName().startsWith("_")) {
FSDataInputStream in = fs.open(f.getPath());
BufferedReader bf=new BufferedReader(new InputStreamReader(in));
String line;
while ((line = bf.readLine()) != null) {
bytesRead += line.getBytes().length;
String towrite=line;
towrite=line.replaceAll(",", "_").replaceAll("\001", ",").replaceAll("\t", ",").replaceAll("\"", "");
if(!towrite.isEmpty()&&towrite.indexOf("rep0")>=0)
{
String[] cols=towrite.split(",");
for(String s:cols)
{
if(s.indexOf("@abtest@")>=0)
{
String[] sss=s.split("@abtest@");
if(sss.length>1)
{
outputA.writeUTF(sss[1]+"\r\n");
break;
}
}
}
}
if(!towrite.isEmpty()&&towrite.indexOf("rep1")>=0)
{
String[] cols=towrite.split(",");
for(String s:cols)
{
if(s.indexOf("@abtest@")>=0)
{
String[] sss=s.split("@abtest@");
if(sss.length>1)
{
outputB.writeUTF(sss[1]+"\r\n");
break;
}
}
}
}
if (bytesRead >= maxsize) {
bf.close();
in.close();
return;
}
}
bf.close();
in.close();
}
}
outputA.close();
outputB.close();