Map Reduce Programs

multifilewc:

A job that counts words from several files.

To run:

bin/hadoop jar hadoop-examples-*.jar multifilewc <in-dir1>,<in-dir2>,<in-dir3>,….,….,…. <out-dir>

Input:

I have given 2 different files as input:

file1:movies.txt

1,The Nightmare Before Christmas,1993,3.9,4568
2,The Mummy,1932,3.5,4388
3,Orphans of the Storm,1921,3.2,9062
4,The Object of Beauty,1991,2.8,6150
5,Night Tide,1963,2.8,5126
6,One Magic Christmas,1985,3.8,5333
7,Muriel’s Wedding,1994,3.5,6323
8,Mother’s Boys,1994,3.4,5733
9,Nosferatu: Original Version,1929,3.5,5651
10,Nick of Time,1995,3.4,5333

file2:sample1.txt

We’re the knights of the round table
We dance whene’er we’re able
We do routines and chorus scenes
With footwork impeccable.
We dine well here in Camelot
We eat ham and jam and spam a lot.

Output:

1,The 1
10,Nick 1
2,The 1
3,Orphans 1
4,The 1
5,Night 1
6,One 1
7,Muriel’s 1
8,Mother’s 1
9,Nosferatu: 1
Beauty,1991,2.8,6150 1
Before 1
Boys,1994,3.4,5733 1
Camelot 1
Christmas,1985,3.8,5333 1
Christmas,1993,3.9,4568 1
Magic 1
Mummy,1932,3.5,4388 1
Nightmare 1
Object 1
Original 1
Storm,1921,3.2,9062 1
Tide,1963,2.8,5126 1
Time,1995,3.4,5333 1
Version,1929,3.5,5651 1
We 4
We’re 1
Wedding,1994,3.5,6323 1
With 1
a 1
able 1
and 3
chorus 1
dance 1
dine 1
do 1
eat 1
footwork 1
ham 1
here 1
impeccable. 1
in 1
jam 1
knights 1
lot. 1
of 4
round 1
routines 1
scenes 1
spam 1
table 1
the 3
we’re 1
well 1
whene’er 1

Screenshots:

mfwc mfwcr

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s