Search code examples
hadoopgrephdfsioerror

Hadoop error when outputting the grep results to a new file in a different directory


I'm trying to read the contents of a few files and using grep find the lines with the my search query and then output the results into a folder in another directory. I get an error "No such file or directory exists". I have created the folder structure and the text file.

hadoop fs -cat /Final_Dataset/c*.txt | grep 2015-01-* > /energydata/2015/01/01.txt

ERROR:

-bash: /energydata/2015/01/01.txt: No such file or directory


Solution

  • The following CLI command worked

    hadoop fs -cat /FinalDataset/c*.txt | grep 2015-01-* | hadoop fs -put - /energydata/2015/01/output.txt