Cari di Shell Script 
    Shell Script Linux Reference Manual
Daftar Isi
(Sebelumnya) B. Reference CardsC.1. Sed Micro-Primer (Berikutnya)

Appendix C. A Sed and Awk Micro-Primer

Daftar Isi
C.1. Sed
C.2. Awk

This is a very brief introduction to the sedand awk text processing utilities. We willdeal with only a few basic commands here, but that will sufficefor understanding simple sed and awk constructs within shellscripts.

sed: a non-interactive text file editor

awk: a field-oriented pattern processing language with a C-style syntax

For all their differences, the two utilities share a similar invocation syntax, use regular expressions , read input by default from stdin, and output to stdout. These are well-behaved UNIX tools, and they work together well. The output from one can be piped to the other, and their combined capabilities give shell scripts some of the power of Perl.

One important difference between the utilities is that while shell scripts can easily pass arguments to sed, it is more complicated for awk (see Example 36-5 and Example 28-2).


Copyright © 2000, by Mendel Cooper <[email protected]>
(Sebelumnya) B. Reference CardsC.1. Sed Micro-Primer (Berikutnya)