GREP

cd /opt/module/hadoop-2.9.2/
mkdir input
cp etc/hadoop/*.xml input
bin/hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-2.9.2.jar grep input output 'dfs[a-z.]+'
cat output/*
// 1	dfsadmin

WordCount

cd /opt/module/hadoop-2.9.2/
mkdir wcinput
cd wcinput
vim wc.input
文件内容:
hadoop yarn
hadoop mapreduce
this
this
保存退出
cd /opt/module/hadoop-2.9.2/
bin/hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-2.9.2.jar wordcount wcinput wcoutput
// hadoop	2
// mapreduce	1
// this	2
// yarn	1