title: How to copy first few lines of a large file in hadoop to a new file?
body: <p>I have one big file in hdfs bigfile.txt. I want to copy the first 100 lines of it into a new file on hdfs. I tried the following command:</p>
  
  <pre><code>hadoop fs -cat /user/billk/bigfile.txt |head -100 /home/billk/sample.txt
  </code></pre>
  
  <p>It gave me a "cat: unable to write output stream" error. I am on hadoop 1.</p>
  
  <p>Are there other ways to do this? (note: copying 1st 100 line to local or another file on hdfs is OK)</p>