今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
Creating an HTML table
- [Instructor] Now that we've discussed many of awk's basic features, let's start putting them together into a program that actually does something useful. One task, for which I personal use awk all the time, is converting a file of information into a formatted table, possibly with some calculations. Suppose you have a tabbed-separated file of bowling scores, like this. In this case, we have the bowler's name at the beginning, and then a tab, and then a number of bowling scores, separated by tabs, on the rest of the line. Suppose you want to output this information as an HTML table, with a header at the top, and an average of each of numeric column at the bottom. Here's how to do it with awk. Let's create an awk program called scores.awk. I'm using the VI editor, but you can use any text editor. Let's start by producing the header, using the HTML tag TH. Because the header appears at the top of the table, we use a special…
随堂练习,边学边练
下载课堂讲义。学练结合,紧跟进度,轻松巩固知识。