title: How to interpret Hadoop Grep command output
body: <p>This is a very basic question concerning the output files generated from running the Grep utility inside a HDFS directory. Essentially, I've included the grep command inside a simple shell script, which is supposed to search this directory for a given string - which is a parameter to the script. The contents of the script are as follows:</p>
  
  <pre><code>#!/bin/bash
  set - e
  cd $HADOOP_HOME
  bin/hadoop org.apache.hadoop.examples.Grep 
  "hdfs://localhost:9000/user/hduser" "hdfs://localhost:9000/user/hduser/out" $1
  bin/hadoop fs -get "hdfs://localhost:9000/user/hduser/out/*" "/opt/data/out/"
  bin/hadoop fs -rm -r "hdfs://localhost:9000/user/hduser/out"
  </code></pre>
  
  <p>The results sent to the hdfs out directory are copied across to a local directory in the second last line. I've deliberately placed two files in this hdfs directory, only one of which contains multiple instances of the string I'm searching for. What ends up in my /opt/data/out directory are the following 2 files. </p>
  
  <pre><code>_SUCCESS 
  part-r-00000
  </code></pre>
  
  <p>The jobs look like they ran successfully, however the only content i'm seeing between both files, is in the "part-r-0000" file, and it's literally the following. </p>
  
  <pre><code>29472   e
  </code></pre>
  
  <p>I suppose I was naively hoping to see the filename where the string was located, and perhaps a count of the number of times it occurred. </p>
  
  <p>My question is, how and where are these values typically returned from the hadoop grep command? I've looked through the console out while the map reduce jobs where running, and there's no reference to the file name where the search string is stored. Any pointers as to how I can access this information would be appreciated, as I'm unsure how to interpret "29472  e".</p>