我不知道 HTML(非常尴尬,但从来没有需要)。当谈到 UNIX 时,我非常有洞察力,但是我对我的这项任务感到非常困惑。我知道我需要做什么,但我正经历着最艰难的开始。
我的 hwk12 目录中有以下文件:
- 名册.html
- 名册.txt
- 示例.html
- 样本.txt
以下是 roster.html 文件的内容:
<html>
<body>
<table border=2>
<tr><th>Name</th><th>Username</th><th>Email</th></tr>
<tr>
<td>Nikhil Banerjee</td>
<td>nbanerje</td>
<td><a href="mailto:zetapsi796@hotmail.com">zetapsi796@hotmail.com</a></td>
</tr>
<tr>
<td>Jeff Nazarian</td>
<td>jnazaria</td>
<td><a href="mailto:jeff.nazarian@asu.edu">jeff.nazarian@asu.edu</a></td>
</tr>
<tr>
<td>Anna Melzer</td>
<td>amelzer</td>
<td><a href="mailto:anna.melzer@asu.edu">anna.melzer@asu.edu</a></td>
</tr>
<tr>
<td>Jose Garcia</td>
<td>jgarcia</td>
<td><a href="mailto:garcia-j@msn.com">garcia-j@msn.com</a></td>
</tr>
<tr>
<td>Jillian Testa</td>
<td>jtesta</td>
<td><a href="mailto:jillian.testa@asu.edu">jillian.testa@asu.edu</a></td>
</tr>
<tr>
<td>Clayton Lengelzigich</td>
<td>clengelz</td>
<td><a href="mailto:clayton.lengel-zigich@asu.edu">clayton.lengel-
zigich@asu.edu</a></td>
</tr>
<tr>
<td>Ashley Bennett</td>
<td>abennett</td>
<td><a href="mailto:ashley.bennett@asu.edu">ashley.bennett@asu.edu</a></td>
</tr>
<tr>
<td>Ann Frost</td>
<td>afrost</td>
<td><a href="mailto:ann.frost@asu.edu">ann.frost@asu.edu</a></td>
</tr>
<tr>
<td>Timothy Whipple</td>
<td>twhipple</td>
<td><a href="mailto:tweed@asu.edu">tweed@asu.edu</a></td>
</tr>
<tr>
<td>Wei Shen</td>
<td>wshen</td>
<td><a href="mailto:shenwei58@hotmail.com">shenwei58@hotmail.com</a></td>
</tr>
<tr>
<td>Cari Mahon</td>
<td>cmahon</td>
<td><a href="mailto:cari.mahon@asu.edu">cari.mahon@asu.edu</a></td>
</tr>
<tr>
<td>Alberto Salas</td>
<td>asalas</td>
<td><a href="mailto:alberto2504@msn.com">alberto2504@msn.com</a></td>
</tr>
<tr>
<td>Dorothy Haskett</td>
<td>dhaskett</td>
<td><a href="mailto:dorothy.haskett@asu.edu">dorothy.haskett@asu.edu</a></td>
</tr>
<tr>
<td>Criss Bradbury</td>
<td>cbradbur</td>
<td><a href="mailto:crissbradbury@hotmaiil.com">crissbradbury@hotmaiil.com</a></td>
</tr>
<tr>
<td>Steve Ellermann</td>
<td>sellerma</td>
<td><a href="mailto:cis494@ellermann.com">cis494@ellermann.com</a></td>
</tr>
<tr>
<td>Zewdie Bekele</td>
<td>zbekele</td>
<td><a href="mailto:zewdiea@aol.com">zewdiea@aol.com</a></td>
</tr>
<tr>
<td>Frederic Diziere</td>
<td>fdiziere</td>
<td><a href="mailto:fsd@asu.edu">fsd@asu.edu</a></td>
</tr>
<tr>
<td>Matt Bowes</td>
<td>mbowes</td>
<td><a href="mailto:matt.bowes@asu.edu">matt.bowes@asu.edu</a></td>
</tr>
<tr>
<td>Jasen Meece</td>
<td>jmeece</td>
<td><a href="mailto:jasen.meece@sun.com">jasen.meece@sun.com</a></td>
</tr>
<tr>
<td>Aaron Carpenter</td>
<td>acarpent</td>
<td><a href="mailto:aaron.carpenter@asu.edu">aaron.carpenter@asu.edu</a></td>
</tr>
<tr>
<td>Binqin Xi</td>
<td>bxi</td>
<td><a href="mailto:binqin.xi@asu.edu">binqin.xi@asu.edu</a></td>
</tr>
<tr>
<td>Yinting Chan</td>
<td>ychan</td>
<td><a href="mailto:yin.chen@asu.edu">yin.chen@asu.edu</a></td>
</tr>
<tr>
<td>Michael Evans</td>
<td>mevans</td>
<td><a href="mailto:michael.evans@asu.edu">michael.evans@asu.edu</a></td>
</tr>
<tr>
<td>Herman Beringer</td>
<td>hberinge</td>
<td><a href="mailto:jber@cox.net">jber@cox.net</a></td>
</tr>
<tr>
<td>Andrew Jolley</td>
<td>ajolley</td>
<td><a href="mailto:andrew@andrewjolley.com">andrew@andrewjolley.com</a></td>
</tr>
<tr>
<td>Michael Raby</td>
<td>mraby</td>
<td><a href="mailto:mike1071@yahoo.com">mike1071@yahoo.com</a></td>
</tr>
<tr>
<td>Hajar Alaoui</td>
<td>halaoui</td>
<td><a href="mailto:hajar6@hotmail.com">hajar6@hotmail.com</a></td>
</tr>
<tr>
<td>Anne Lemar</td>
<td>alemar</td>
<td><a href="mailto:anne.lemar@asu.edu">anne.lemar@asu.edu</a></td>
</tr>
<tr>
<td>Russell Crotts</td>
<td>rcrotts</td>
<td><a href="mailto:Russell.Crotts@asu.edu">Russell.Crotts@asu.edu</a></td>
</tr>
<tr>
<td>Dan Mazzola</td>
<td>dmazzola</td>
<td><a href="mailto:dan.mazzola@sun.com">dan.mazzola@sun.com</a></td>
</tr>
<tr>
<td>Bill Boyton</td>
<td>bboyton</td>
<td><a href="mailto:boytonb@earthlink.net">boytonb@earthlink.net</a></td>
</tr>
</table>
</body>
</html>
以下是 roster.txt 文件的内容:
Whipple Timothy tweed@asu.edu Shen Wei shenwei58@hotmail.com
Mahon Cari cari.mahon@asu.edu Salas Alberto alberto2504@msn.com
Haskett Dorothy dorothy.haskett@asu.edu Bradbury Criss
crissbradbury@hotmaiil.com Ellermann Steve
cis494@ellermann.com Bekele Zewdie zewdiea@aol.com Diziere Frederic
fsd@asu.edu Bowes Matt matt.bowes@asu.edu Meece Jasen
jasen.meece@sun.com Carpenter Aaron aaron.carpenter@asu.edu
Xi Binqin binqin.xi@asu.edu Chan Yinting yin.chen@asu.edu
Evans Michael michael.evans@asu.edu Beringer Herman
jber@cox.net Jolley Andrew andrew@andrewjolley.com Raby Michael
mike1071@yahoo.com Alaoui Hajar hajar6@hotmail.com Lemar Anne
anne.lemar@asu.edu Crotts Russell Russell.Crotts@asu.edu Mazzola Dan
dan.mazzola@sun.com Boyton Bill boytonb@earthlink.net
以下是 sample.html 文件的内容:
<html>
<body>
<table border=2>
<tr><th>Name</th><th>Username</th><th>Email</th></tr>
<tr>
<td>Michael Raby</td>
<td>mraby</td>
<td><a href="mailto:mike1071@yahoo.com">mike1071@yahoo.com</a></td>
</tr>
<tr>
<td>Hajar Alaoui</td>
<td>halaoui</td>
<td><a href="mailto:hajar6@hotmail.com">hajar6@hotmail.com</a></td>
</tr>
<tr>
<td>Anne Lemar</td>
<td>alemar</td>
<td><a href="mailto:anne.lemar@asu.edu">anne.lemar@asu.edu</a></td>
</tr>
<tr>
<td>Russell Crotts</td>
<td>rcrotts</td>
<td><a href="mailto:Russell.Crotts@asu.edu">Russell.Crotts@asu.edu</a></td>
</tr>
<tr>
<td>Dan Mazzola</td>
<td>dmazzola</td>
<td><a href="mailto:dan.mazzola@sun.com">dan.mazzola@sun.com</a></td>
</tr>
<tr>
<td>Bill Boyton</td>
<td>bboyton</td>
<td><a href="mailto:boytonb@earthlink.net">boytonb@earthlink.net</a></td>
</tr>
</table>
</body>
</html>
以下是sample.txt文件的内容:
Raby Michael mike1071@yahoo.com
Alaoui Hajar hajar6@hotmail.com
Lemar Anne anne.lemar@asu.edu
Crotts Russell Russell.Crotts@asu.edu
Mazzola Dan dan.mazzola@sun.com
Boyton Bill boytonb@earthlink.net
我不是因为我喜欢 UNIX 并且我想自己学习它而要求有人为我做这件事。每次我看到这段 HTML 代码时,我都会把自己的 #$$#& 搞糊涂。我需要帮助开始。
作业提示如下:
您将编写一个名为 ~/hwk12/mk_html.awk 的 nawk(1) 脚本,它将文本文件(sample.txt 和 roster.txt)转换为 Web 浏览器可以读取的 html 页面。我在 sample.html 文件中为您提供了输出,该文件在下面复制(请注意每个缩进级别如何深两个空格):
同样,我不希望有人为我这样做。我只是对文本文件中的数据如何在没有实际 HTML 代码的情况下附加到 HTML 表中感到困惑。有人可以帮我开始吗?