把第一个html里的东西按照不同的类型排序,生成一些其他的by_xxx的html的脚本怎么写?

把第一个html里的东西按照不同的类型排序,生成一些其他的by_xxx的html的脚本怎么写?

There is a file under
/alicn32/htdocs/hw/tools/cell_stat.html that contains cell and their delay,
loading, fanout statistics. Write a script to sort the table by either cell
area, fanout, delay, or cap loading, which will be specified by the user.
That is, if your script is call sort_table, then the user may invoke
    sort_table by_cap cell_stat.html > cell_stat_by_cap.html     # for
sorting according to the cap loading, or
    sort_table by_area cell_stat.html > cell_stat_by_area.html   # for
sorting according to the area used, etc.
(See attached file: cell_stat.html)

大家帮帮忙了。
这样的脚本怎么写呀?      
提供一个参考,按你要的顺序查找内容,比如按字母顺序的话,就从开始查以a开头的,一直查到以z开头的,然后把查找的结果按顺序输出。