21.07.2015 Views

GAWK: Effective AWK Programming

GAWK: Effective AWK Programming

GAWK: Effective AWK Programming

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

174 <strong>G<strong>AWK</strong></strong>: <strong>Effective</strong> <strong>AWK</strong> <strong>Programming</strong>}print "if is true"elseprint "else is true"BEGIN { print "Second BEGIN rule" }END { print "Second END rule" }function sing( dummy){print "I gotta be me!"}Following is the input data:foobarbazfoojunkHere is the ‘awkprof.out’ that results from running pgawk on this program and data(this example also illustrates that awk programmers sometimes have to work late):# gawk profile, created Sun Aug 13 00:00:15 2000# BEGIN block(s)BEGIN {1 print "First BEGIN rule"1 print "Second BEGIN rule"}# Rule(s)5 /foo/ { # 22 print "matched /foo/, gosh"6 for (i = 1; i

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!