Sams Teach Yourself Shell Programming in (Ecommerce web host) 24 Hours

Sams Teach Yourself Shell Programming in 24 Hours Contents Index Hour 17: Filtering Text with awk Previous Chapter Next Chapter Sections in this Chapter: What is awk? Questions Using awk Features Terms Summary Previous Section Next Section Using awk Features Variables Flow Control You have seen some of the basics of using awk, and you’ll now look at some of the more powerful features that it provides. The main topics are l Variables l Flow control l Loops These features let you fully exploit the power of awk. Variables Variables in awk are similar to variables in the shell: They are words that refer to a value. The basic syntax of defining a variable is name=value Here name is the name of the variable, and value is the value of that variable. For example, the following awk command fruit=”peach” creates the variable fruit and assigns it the value peach. There is no need to initialize a variable: the first time you use it, it is initialized. Like the shell, the name of a variable can contain only letters, numbers, and underscores. A variable’s name cannot start with a number. You can assign both numeric and string values to a variable in the same script. For example, consider the following awk commands: fruit=”peach” fruit=100 The first command assigns the value peach to the variable fruit. The second command assigns the value 100 to the variable fruit.
Go visit our java server pages services for a reliable, lowcost webhost to satisfy all your needs.

Leave a Reply