Member since
08-02-2013
41
Posts
9
Kudos Received
6
Solutions
09-17-2013
02:30 PM
I got it! But it seems overly complicated to grab one crummy line from a file... 375 String dateString = "";
376 FileSystem fileSystem = FileSystem.get(configuration);
377 FileStatus[] fileStatus = fileSystem.listStatus(new Path("/temp/query2job2temp"));
378 for (FileStatus status : fileStatus) {
379 Path path = status.getPath();
380 if(path.toString().matches(".*part.*")) {
381 BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(fileSystem.open(path)));
382 dateString = bufferedReader.readLine();
383 Pattern pattern = Pattern.compile("([0-9]{2}/[0-9]{2}/[0-9]{2})");
384 Matcher matcher = pattern.matcher(dateString);
385 if(matcher.find()) {
386 dateString = matcher.group(0);
387 }
388 bufferedReader.close();
389 }
390 }
... View more