This unix and linux site aims to provide book reviews and free ebook on unix linux, unix commands, unix shell, unix programming, unix shell scripting, unix tutorial, suse linux, rehat linux, debian linux, slackware linux, linux server, linux commands, fedora linux, linux gui, linux networking, unix time sharing concepts, programming linux games, samba-3, motif programming, unix signal programming, and linux complete reference, etc

Awk by example, Part 3

String functions and ... checkbooks
By Daniel Robbins

In this conclusion to the awk series, Daniel introduces you to awk's important string functions, and then shows you how to write a complete checkbook-balancing program from scratch. Along the way, you'll learn how to write your own functions and use awk's multidimensional arrays. By the end of this article, you'll have even more awk experience, allowing you to create more powerful scripts.

Formatting output
While awk's print statement does do the job most of the time, sometimes more is needed. For those times, awk offers two good old friends called printf() and sprintf(). Yes, these functions, like so many other awk parts, are identical to their C counterparts. printf() will print a formatted string to stdout, while sprintf() returns a formatted string that can be assigned to a variable. If you're not familiar with printf() and sprintf(), an introductory C text will quickly get you up to speed on these two essential printing functions. You can view the printf() man page by typing "man 3 printf" on your Linux system.

Click to Read More

Popular Posts

Linux Unix Books