`
sharp-fcc
  • 浏览: 105439 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

awk and hadoop 之reducer

阅读更多

配合上面一篇 mapper篇,这篇主要讲在reducer的时候怎么处理两个文件中的内容,在mapper中我们给每个文件中的内容打了 tag ,在第二个字段,然后就能处理了,只要key一样,就可以弄到一个文件中去。

awk -F '\t' '{
  id = $1;
  tag = $2;
  if (0 == tag){
    idPre = $1;
  }else (1 == tag && id == idPre){
    print $3"\t"id;    
  }  
}'

 

分享到:
评论

相关推荐

    awk and sed

    awk and sedawk and sedawk and sedawk and sedawk and sedawk and sedawk and sedawk and sedawk and sedawk and sedawk and sedawk and sedawk and sedawk and sedawk and sedawk and sedawk and sedawk and sed

    awk and sed 3

    最新版本的awk和sed,个人感觉挺好的,大家可以下载看看

    awk and sek 2nd

    OReilly.Sed.And.Awk.2nd.Edition.pdf

    awk and sed修订完美高清第三版

    awk and sed修订完美高清第三版,awk与sed这2个工具得确不错

    Awk入门教程 《Awk A Tutorial and Introduction - by Bruce Barnett》

    Awk入门教程。作者 Bruce Barnett 注:英文版。以下是目录 Why learn AWK? Basic Structure Executing an AWK script Which shell to use with AWK? Dynamic Variables The Essential Syntax of AWK ...

    awk tutorial and introduction 英文版

    awk tutorial and introduction 英文版 网上的连接 http://www.askapache.com/linux/awk-tutorial.html

    sed_awk.chm

    This book is about a set of oddly named UNIX utilities, sed and awk. These utilities have many things in common, including the use of regular expressions for pattern matching. Since pattern matching ...

    awk学习awk学习awk学习awk学习

    awk学习awk学习awk学习awk学习awk学习awk学习awk学习

    sed and awk 101 hacks

    sed & awk 101 hacks 是sed和awk入门和提高的文档。

    sed and awk 101 hacks.pdf

    免积分下载。

    awk入门到精通.pdf

    (awk 指令并不多, 且其中之大部分与 C语言中之用法一致, 本手册中对该类指令之语法及特性 不再加以繁冗的说明, 读者若欲深究,可自行翻阅相关的 C 语言书籍) 2. awk概述 为什么使用awk awk 是一种程序语言. 它具有...

    Effective awk Programming

    The focus is on the practical side of creating and running awk scripts, and there's plenty of hands-on advice for installing and running today's awk (and gawk)., The book begins with the fundamentals...

    AWK用法AWK用法AWK用法

    awk ‘/101/’ file 显示文件file中包含101的匹配行。 awk ‘/101/,/105/’ file awk ‘$1 == 5′ file awk ‘$1 == “CT”‘ file 注意必须带双引号 awk ‘$1 * $2 >100 ‘ file awk ‘$2 >5 && $2<=15' file

    sed and awk文档合集

    说是sed和awk的合集,但是里面也有很多其它的东西.其中就包括了一个windows版的grep.本来也有windows的sed,不过好像不好用.呵呵.希望大家捧场. 里面有很多不错的例子.懒得看文档的人有福了阿.

    Sed and Awk 单行脚本快速参考

    Sed and Awk 单行脚本快速处理字符或者文本

    学习和理解AWK的最佳书籍Effective AWK Programming

    学习和理解AWK的最佳书籍  一致这本书是学习awk的最好书籍,网上下不到的,国内也买不到。国家图书馆和北京大学图书馆都有。强烈建议所有想学awk的同志们阅读(会有很多awk语言之外的启迪) 偶然机会得到,不敢独享...

    awk and sed 中文版

    注意是“第3版”rhel饭醉集团出品 国内牛人适当改编第2版 仅供学习。

    awk.Effective.awk.Programming.Universal.Text.Processing.and.Pattern.Matching.4th

    awk.Effective.awk.Programming.Universal.Text.Processing.and.Pattern.Matching.4th

Global site tag (gtag.js) - Google Analytics