[好书推荐] [Linux编程] sed & awk (2nd Edition)(O'Reilly,1997)
1。基本信息书名: sed & awk (2nd Edition)
作者: Arnold Robbins, Dale Dougherty
电子版格式: chm
页数: 432 pages
出版社: O'Reilly Media; 2 edition (March 1, 1997)
语言: English
ISBN-10: 1565922255
ISBN-13: 978-1565922259
下载地址: http://suniap.ys168.com
2。推荐理由
前面我推荐了一本 bash shell的教程
Advanced Bash-Scripting Guide
如果有人要学或者要用Shell的话,就会发现 Shell实际上是一个平台,它虽然是Unix/Linux的基础,但是当他与其他Linux工具组合时,功能变得异常强大。这些Linux工具中包括常用的Linux命令find、grep等等,还有另外两个最为强大也相对独立成员:sed 和 awk.
sed和awk是一般用户以及程序员和系统管理员们处理文本文件的有力工具. sed的名字来源于其功能, 它是一个字符流编辑器(streamceditor),可以很好地完成对多个文件的一系列编辑工作. awk的名字来源于它的开发人Aho.cWeinberger和Kernighan, 它是一种程序设计语言, 非常适合结构化数据的处理和格式化报表的生成.
这本书章节如下,实际上可以分成几个层次
第一层次: Chapter 1: Power Tools for Editing
介绍了sed和awk的历史和能为你做什么,可以简略的看看
第二层次,是基本操作的层面,如果你不需要成为很高级的程序员,学到这个层次里面,就已经能够帮助你完成大多数工作了。内容包括:
Chapter 2: Understanding Basic Operations
Chapter 3: Understanding Regular Expression Syntax
介绍了sed和awk的基本操作。一般的读者了解到这些操作之后就能够让你平时里操作Shell时事半功倍。最重要的是第三章,关于正则表达式的教程,给出了详细的例子,让你在实践中领略到正则表达式的魅力。这部分我觉得是写的最好的一部分,把程序语言中最变幻莫测的正则表达式,用一小章的内容表达的如此清楚我还是第一次见到。事实上,把握了这里的正则表达式,Java及微软平台常用语言里的的正则表达式您已基本上精通了,linux下的其他程序如vi, grep等命令您也精通了。所以,
建议这章里面的每一个例子都要亲自运行
这本书把这些实例设计的如此精巧,以致于当你运行完最后一个例子之后,你差不多就基本上了解了正则表达式的精华了。
由于正则表达式的复杂性,一下子不可能全部记的住和灵活运用,所以,又建议:
反复研读第三章并对不理解的例子亲自运行
第三个层次,是提高的层次。如果你想在Shell里面成为高手,后面的内容是必看的,但是相对于前面的基础,当你进阶之后,后面的这些就不算难了。
Chapter 4: Writing sed Scripts
Chapter 5: Basic sed Commands
Chapter 6: Advanced sed Commands
Chapter 7: Writing Scripts for awk
Chapter 8: Conditionals, Loops, and Arrays
Chapter 9: Functions
Chapter 10: The Bottom Drawer
Chapter 11: A Flock of awks
Chapter 12: Full-Featured Applications
Chapter 13: A Miscellany of Scripts
其实很多英文经典的计算机类语言类教程最精华的是设计的程序实例,这本书跟其他所有优秀的作品一样,最出色的是在其中的实例上,作者很少直接出来解释什么,他们把这些sed和awk的精华全部在实例代码的分析中告诉了大家。
3。附本书英文Reviews和Description
Editorial Reviews
Book Description
sed & awk describes two text processing programs that are mainstays of the UNIX programmer's toolbox. sed is a \"stream editor\" for editing streams of text that might be too large to edit as a single file, or that might be generated on the fly as part of a larger data processing step. The most common operation done with sed is substitution, replacing one block of text with another. awk is a complete programming language. Unlike many conventional languages, awk is \"data driven\" -- you specify what kind of data you are interested in and the operations to be performed when that data is found. awk does many things for you, including automatically opening and closing data files, reading records, breaking the records up into fields, and counting the records. While awk provides the features of most conventional programming languages, it also includes some unconventional features, such as extended regular expression matching and associative arrays. sed & awk describes both programs in detail and includes a chapter of example sed and awk scripts. This edition covers features of sed and awk that are mandated by the POSIX standard. This most notably affects awk, where POSIX standardized a new variable, CONVFMT, and new functions, toupper() and tolower(). The CONVFMT variable specifies the conversion format to use when converting numbers to strings (awk used to use OFMT for this purpose). The toupper() and tolower() functions each take a (presumably mixed case) string argument and return a new version of the string with all letters translated to the corresponding case. In addition, this edition covers GNU sed, newly available since the first edition. It also updates the first edition coverage of Bell Labs nawk and GNU awk (gawk), covers mawk, an additional freely available implementation of awk, and briefly discusses three commercial versions of awk, MKS awk, Thompson Automation awk (tawk), and Videosoft (VSAwk).
Book Info
Provides an overview and describes how to write Sed scripts. Covers common programming constructs, how to use Awk built-in functions, how to write user-defined functions, debugging techniques for Awk programs and more. Second edition covers Awk as described by the POSIX standard. Paper.
页:
[1]