Joyent Manta

Total word count

This job takes any number of plain text objects (e.g., mailbox files or source code) and computes the total number of characters, words, and lines in all of the objects, much like the "wc" Unix command.

The job has two phases: the first phase (a map phase) processes the inputs in parallel, and the second phase (a reduce phase) adds the results together to produce a single output.

Run it yourself

Once you've set up the Manta CLI tools, you can run this job yourself on the publicly accessible dataset using the following command:

$ mfind -n '.*.txt' /manta/public/examples/shakespeare | \
    mjob create -n "Total word count" -o -m wc -r \
    "awk '{ l += \$1; w += \$2; c += \$3 } END { print l, w, c }'"

which outputs:

added 42 inputs to 89182470-3d6c-6561-a3f1-86f679ef3281
172948 939193 5283795

Job body

[
        {
                "exec": "wc",
                "type": "map"
        },
        {
                "exec": "awk '{ l += $1; w += $2; c += $3 } END { print l, w, c }'",
                "type": "reduce"
        }
]

Input summary

(show) /manta/public/examples/shakespeare/1kinghenryiv.txt
(show) /manta/public/examples/shakespeare/2kinghenryvi.txt
(show) /manta/public/examples/shakespeare/2kinghenryiv.txt
(show) /manta/public/examples/shakespeare/1kinghenryvi.txt
(show) /manta/public/examples/shakespeare/3kinghenryvi.txt
(show) /manta/public/examples/shakespeare/allswellthatendswell.txt
(show) /manta/public/examples/shakespeare/coriolanus.txt
(show) /manta/public/examples/shakespeare/asyoulikeit.txt
(show) /manta/public/examples/shakespeare/cymbeline.txt
(show) /manta/public/examples/shakespeare/antonyandcleopatra.txt
(show) /manta/public/examples/shakespeare/comedyoferrors.txt
(show) /manta/public/examples/shakespeare/hamlet.txt
(show) /manta/public/examples/shakespeare/kingjohn.txt
(show) /manta/public/examples/shakespeare/kinghenryviii.txt
(show) /manta/public/examples/shakespeare/kinghenryv.txt
(show) /manta/public/examples/shakespeare/kinglear.txt
(show) /manta/public/examples/shakespeare/juliuscaesar.txt
(show) /manta/public/examples/shakespeare/kingrichardii.txt
(show) /manta/public/examples/shakespeare/kingrichardiii.txt
(show) /manta/public/examples/shakespeare/measureforemeasure.txt
(show) /manta/public/examples/shakespeare/loverscomplaint.txt
(show) /manta/public/examples/shakespeare/loveslabourslost.txt
(show) /manta/public/examples/shakespeare/macbeth.txt
(show) /manta/public/examples/shakespeare/merchantofvenice.txt
(show) /manta/public/examples/shakespeare/midsummersnightsdream.txt
(show) /manta/public/examples/shakespeare/periclesprinceoftyre.txt
(show) /manta/public/examples/shakespeare/merrywivesofwindsor.txt
(show) /manta/public/examples/shakespeare/othello.txt
(show) /manta/public/examples/shakespeare/muchadoaboutnothing.txt
(show) /manta/public/examples/shakespeare/rapeoflucrece.txt
(show) /manta/public/examples/shakespeare/sonnets.txt
(show) /manta/public/examples/shakespeare/romeoandjuliet.txt
(show) /manta/public/examples/shakespeare/tempest.txt
(show) /manta/public/examples/shakespeare/timonofathens.txt
(show) /manta/public/examples/shakespeare/tamingoftheshrew.txt
(show) /manta/public/examples/shakespeare/titusandronicus.txt
(show) /manta/public/examples/shakespeare/venusandadonis.txt
(show) /manta/public/examples/shakespeare/troilusandcressida.txt
(show) /manta/public/examples/shakespeare/twogentlemenofverona.txt
(show) /manta/public/examples/shakespeare/twelfthnight.txt
(show) /manta/public/examples/shakespeare/winterstale.txt
(show) /manta/public/examples/shakespeare/various.txt

Output summary

1 total outputs
(show) /manta/jobs/89182470-3d6c-6561-a3f1-86f679ef3281/stor/reduce.1.d08cbd34-2e32-486f-a6ce-726f8a336e58

Error summary

0 total errors