21.07.2015 Views

GAWK: Effective AWK Programming

GAWK: Effective AWK Programming

GAWK: Effective AWK Programming

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

122 <strong>G<strong>AWK</strong></strong>: <strong>Effective</strong> <strong>AWK</strong> <strong>Programming</strong>input has been read, to print out all the lines. When this program is run with the followinginput:5 I am the Five man2 Who are you? The new number two!4 . . . And four on the floor1 Who is number one?3 I three you.Its output is:1 Who is number one?2 Who are you? The new number two!3 I three you.4 . . . And four on the floor5 I am the Five manIf a line number is repeated, the last line with a given number overrides the others. Gapsin the line numbers can be handled with an easy improvement to the program’s END rule,as follows:END {for (x = 1; x

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

Saved successfully!

Ooh no, something went wrong!