The uniq(1) command can be viewed as a tiny map/reduce-style program:

  • map consecutive, identical input lines into groups;
  • reduce the list of lines (which are all identical) to a single line.

Are there more examples of programs in this (functional) style in Unix? And, if I would like to use another map or reduce function, are there more generic tools out there that let one provide custom mappers and reducers?

Maybe something like this:

mapreducer -mapper prog1 -reducer prog2 < input > output

There's a tool out there called "bashreduce"

Article: http://www.linux-mag.com/id/7407/

GitHub: https://github.com/erikfrey/bashreduce

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.