Welcome to Scribd. Sign in or start your free trial to enjoy unlimited e-books, audiobooks & documents.Find out more
Buy Now $31.99
Standard view
Full view
of .
Look up keyword or section
Like this
8Activity

Table Of Contents

MayYou SolveInteresting Problems
Four Hurdles to Mastering sed and awk
Awk, bySed and Grep,out of Ed
Command-Line Syntax
Using sed
Using awk
Using sed and awk Together
That’s an Expression
ALine-Up of Character s
INever Metacharacter I Didn’tLike
Applying Commands in a Script
Four Types of sed Scripts
Getting to the PromiSed Land
About the Syntax of sed Commands
Comment
Substitution
Delete
Append, Insert, and Change
List
Tr ansfor m
Pr intLine Number
Next
Reading and Writing Files
Quit
Multiline Patter nSpace
Advanced FlowControl Commands
To Join a Phrase
Playing the Game
Awk’s Programming Model
Patter nMatching
Records and Fields
System Var iables
Relational and Boolean Operator s
Infor mationRetr ieval
Conditional Statements
Looping
Other Statements That Affect FlowControl
An Acronym Processor
System Var iables That AreArrays
Ar ithmeticFunctions
Wr itingYour Own Functions
•The getlinefunction
Thegetline Function
AMenu-Based Command Generator
Directing Output to Files and Pipes
Generating Columnar Repor ts
Limitations
Invoking awk Using the #! Syntax
Or iginal awk
An InteractiveSpelling Checker
Generating a For mattedIndex
adj — AdjustLines for TextFiles
Index
P. 1
sed & awk

sed & awk

Ratings:

3.72

(1)
|Views: 597|Likes:

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).

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).

More info:

Publish date: Mar 1, 1997
Added to Scribd: Sep 02, 2011
Copyright:Traditional Copyright: All rights reservedISBN:9781449301880
List Price: $31.99 Buy Now

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
This book can be read on up to 6 mobile devices.
See more
See less

08/14/2015

434

9781449301880

$31.99

USD

You're Reading a Free Preview
Pages 18 to 82 are not shown in this preview.
You're Reading a Free Preview
Pages 100 to 137 are not shown in this preview.
You're Reading a Free Preview
Pages 155 to 290 are not shown in this preview.
You're Reading a Free Preview
Pages 308 to 342 are not shown in this preview.
You're Reading a Free Preview
Pages 360 to 434 are not shown in this preview.

Activity (8)

You've already reviewed this. Edit your review.
encephalical reviewed this
I read this curious to see if I'd use either to replace Perl or Python in my workflow. SED I can definitely see using for quick one off edits. AWK, especially in light of the longer examples given later in this book, I don't see using. AWK is worth learning a bit about for its approach.I used the 1997 second edition. Some of the examples are a bit dated. The prose is more readable than some by this publisher.
alogon_1 reviewed this
SED stands for "Stream Editor." I wish that I had discovered this tool years before I did, but had been discouraged by the daunting vocabulary of rigorous descriptions. SED was originally written for the UNIX operating system but has been ported to MSDOS by Eric S. Raymond. You can do fairly sophisticated extraction from or modification of text files with remarkably terse (if highly cryptic-looking) instructions. (Actually, for merely searching or extracting, the "Grep" tool is even better, but DOS versions that I have seen do not conform so well to the UNIX standard tool.)This book is a patient exposition of the program's capabilities that takes the reader from the simplest examples. The Awk language, which adds much to the editing powers of SED, has probably been largely superseded by Perl, which is much more powerful still. However, the Awk interpreter is small and compact, compared to modern Perl implementations which have become large and elaborate. Shell scripts in Linux call upon it frequently.Regular expressions in Grep, SED, Awk, and Perl (respectively) differ in detail from one another. If I have any criticism of this book, it would be that it sometimes discusses SED and Awk together without pointing out once again these differences if a reader has forgotten them. This sometimes makes the book confusing as a reference.
1 hundred reads
1 thousand reads
mansoorulhaq liked this
amuduli liked this
Pooja Dangi liked this
B R liked this

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->