Merging Files using PIG

0 votes
How do I merge multiple small .txt files stored in an HDFS Location into a single File using PIG?
Jul 4 in Big Data Hadoop by Suraj
206 views

1 answer to this question.

0 votes

In order to merge two or more files into one single file and store it in hdfs, you need to have a folder in the hdfs path containing the files that you want to merge.

Here, I am having a folder namely merge_files which contains the following files that I want to merge
image

Then you can execute the following command to the merge the files and store it in hdfs:

hadoop fs -cat /user/edureka_425640/merge_files/* | hadoop fs -put - /user/edureka_425640/merged_file s

The merged_files folder need not be created manually. It is going to be created automatically to store your output when you are using the above command. You can view your output using the following command. Here my merged_files is storing my output result.

hadoop fs -cat merged_files

Please refer to the below screenshot:

image

answered Jul 4 by Tina

Related Questions In Big Data Hadoop

0 votes
1 answer

Merging Files using PIG

In order to merge two or more ...READ MORE

answered Jul 9 in Big Data Hadoop by Tina
40 views
0 votes
1 answer

Moving files in Hadoop using the Java API?

I would recommend you to use FileSystem.rename(). ...READ MORE

answered Apr 15, 2018 in Big Data Hadoop by Shubham
• 13,350 points
967 views
0 votes
1 answer

How do I join 2 tables in PIG using 2 fields?

Here, we have two tables: Tab1 having columns ...READ MORE

answered Dec 13, 2018 in Big Data Hadoop by Omkar
• 68,480 points
151 views
0 votes
1 answer

Using HBase jar files. Where to download and set classpath

There are many sites you can get ...READ MORE

answered Dec 14, 2018 in Big Data Hadoop by Omkar
• 68,480 points
486 views
0 votes
1 answer

What do we exactly mean by “Hadoop” – the definition of Hadoop?

The official definition of Apache Hadoop given ...READ MORE

answered Mar 16, 2018 in Big Data Hadoop by Shubham
249 views
0 votes
1 answer

Hadoop Mapreduce word count Program

Firstly you need to understand the concept ...READ MORE

answered Mar 16, 2018 in Data Analytics by nitinrawat895
• 10,800 points
3,573 views
0 votes
1 answer

hadoop.mapred vs hadoop.mapreduce?

org.apache.hadoop.mapred is the Old API  org.apache.hadoop.mapreduce is the ...READ MORE

answered Mar 16, 2018 in Data Analytics by nitinrawat895
• 10,800 points
453 views
+1 vote
11 answers

hadoop fs -put command?

put syntax: put <localSrc> <dest> copy syntax: copyFr ...READ MORE

answered Dec 7, 2018 in Big Data Hadoop by Aditya
18,416 views
0 votes
1 answer

Pig: Does these jar files run in NodeManager to produce result?

Below is what happens with the map-reduce ...READ MORE

answered Jul 10 in Big Data Hadoop by Lucy
32 views
0 votes
1 answer