The original awk has remained almost the same (Make a web site)
The original awk has remained almost the same since its first introduction to UNIX in 1978. Originally it was intended to be a small programming language for filtering text and producing reports. By the mid-1980s, people were using awk for large programs, so in 1985 its authors decided to extend it. This version, called nawk (as in new awk ), was released to the public in 1987 and became a part of SunOS 4.1. x. Its developers intended for nawk to replace awk eventually. This has yet to happen. Most commercial UNIX versions such as HP-UX and Solaris still ship with both awk and nawk. In 1992 the Institute of Electrical and Electronics Engineers (IEEE) standardized awk as part of its Portable Operating Systems Interface standard (POSIX). gawk, the GNU version of awk, is based on this standard. All Linux systems ship with gawk. The examples in this chapter work with any version of awk. Basic Syntax The basic syntax of an awk command is awk ’script’ files Here files is a list of one or more files, and script is one or more commands of the form: /pattern/ { actions } Here pattern is a regular expression, and actions is one or more of the commands that are covered later in this chapter. If pattern is omitted, awk performs the specified actions for each input line. Look at the simplest task in awk, displaying all the input lines from a file. In this case you use a modified version of the file fruit_prices.txt from the previous chapter: $ awk ‘{ print ; }’ fruit_prices.txt Fruit Price/lbs Quantity Banana $0.89 100 Peach $0.79 65 Kiwi $1.50 22 Pineapple $1.29 35 Apple $0.99 78 Here you use the awk command print to print each line of the input. When the print command is given without arguments, it prints the input line exactly as it was read. Notice that there is a semicolon (
after the print command. This semicolon is required to let awk know that the command has concluded. Strictly speaking, some older versions of awk do not require this, but it is good practice to include it anyway. Field Editing
Searching for affordable and reliable webhost to host and run your web applications? Go to our java web server services and you will be pleased.