测试文本test.txt
----------------------------
retrieval is the process of extracting data from a file and generating
a report.
The key to all of these operations is that the data has some kind of
structure. Let us illustrate this with the analogy of a bureau. A bureau
consists of multiple drawers, and each drawer has a certain set of contents:
socks in one drawer, underwear in another, and sweaters in a third drawer.
homework drawers have compartments allowing different kinds of things
to be homework together. These are all structures that determine where
things go - when you are sorting the laundry - and where things can be
found - when you are getting dressed. Awk allows you to use the structure
of a text file in writing the procedures for putting things in and taking
things out.
Thus, the benefits of awk are best realized when the data has some kind of structure. A text file can be loosely or tightly structured. A chapter
containing major and minor sections has some structure. We'll look at a
script that extracts section headings and numbers them to produce an
outline. A table consisting of tab-separated items in columns might be
considered very structured. You could use an awk script to reorder columns
of data, or even change columns into rows and rows into columns.
Like sed scripts, awk scripts are typically invoked by means of a shell
wrapper. This is a shell script that usually contains the command line
that invokes awk as well as the script that awk interprets. Simple one-line
awk scripts can be entered from the command line.
Some of the things awk allows you to do are:
View a text file as a textual database made up of records and fields.
Use variables to manipulate the database.
Use arithmetic and string operators.
Use common programming constructs such as loops and conditionals.
Generate formatted reports.
Define functions.
Execute UNIX commands from a script.
Process the result of UNIX commands.
Process command-line arguments more gracefully.
Work more easily with multiple input streams.
Because of these features, awk has the power and range that users might
rely upon to do the kinds of tasks performed by shell scripts. In this
-----------------------------------------
上面的一段文本是一本叫 《Sed&awk》 的书籍摘下来的,我的想法是这样的
因为我英文比叫差,长一点的单词就不认识了,我想对长一点的单词注中文解释。
我昨天整理了文本形式的单词库,在上面的文本 查找长度大于7的单词,然后将
长度 大于7 的单词与单词库a.txt比对。如果有这个单词的解释就加在这个单词所在的行
的下一行。效果如下。
-----------------------------------------------------------------
retrieval is the process of extracting data from a file and generating
retrieval n.取回, 恢复, 修补,重获,挽救,拯救
extracting 萃取, 提取, 提炼
generating 发生, 产生
a report.
The key to all of these operations is that the data has some kind of
operations n.运转, 操作, 实施, 作用, 业务, 工作, 手术, 军事行动
structure. Let us illustrate this with the analogy of a bureau. A bureau
structure 数据类型)结构,结构体
illustrate vt.举例说明, 图解, 加插图于, 阐明 vi.举例
----------------------------------------------------
单词库部分 a.txt
------------------------------------
retrieval n.取回, 恢复, 修补,重获,挽救,拯救
extracting 萃取, 提取, 提炼
generating 发生, 产生
operations n.运转, 操作, 实施, 作用, 业务, 工作, 手术, 军事行动
structure 数据类型)结构,结构体
illustrate vt.举例说明, 图解, 加插图于, 阐明 vi.举例
conditionals adj.有条件的, 引起条件反应的
multiple adj.多样的, 多重的 n.倍数, 若干 v.成倍增加
conditionals adj.有条件的, 引起条件反应的
manipulate vt.(熟练地)操作, 使用(机器等), 操纵(人或市价、市场), 利用, 应付
------------------------------------------------
先谢谢各位兄弟!!!
[ Last edited by guixi on 2007-10-26 at 11:58 PM ]
----------------------------
retrieval is the process of extracting data from a file and generating
a report.
The key to all of these operations is that the data has some kind of
structure. Let us illustrate this with the analogy of a bureau. A bureau
consists of multiple drawers, and each drawer has a certain set of contents:
socks in one drawer, underwear in another, and sweaters in a third drawer.
homework drawers have compartments allowing different kinds of things
to be homework together. These are all structures that determine where
things go - when you are sorting the laundry - and where things can be
found - when you are getting dressed. Awk allows you to use the structure
of a text file in writing the procedures for putting things in and taking
things out.
Thus, the benefits of awk are best realized when the data has some kind of structure. A text file can be loosely or tightly structured. A chapter
containing major and minor sections has some structure. We'll look at a
script that extracts section headings and numbers them to produce an
outline. A table consisting of tab-separated items in columns might be
considered very structured. You could use an awk script to reorder columns
of data, or even change columns into rows and rows into columns.
Like sed scripts, awk scripts are typically invoked by means of a shell
wrapper. This is a shell script that usually contains the command line
that invokes awk as well as the script that awk interprets. Simple one-line
awk scripts can be entered from the command line.
Some of the things awk allows you to do are:
View a text file as a textual database made up of records and fields.
Use variables to manipulate the database.
Use arithmetic and string operators.
Use common programming constructs such as loops and conditionals.
Generate formatted reports.
Define functions.
Execute UNIX commands from a script.
Process the result of UNIX commands.
Process command-line arguments more gracefully.
Work more easily with multiple input streams.
Because of these features, awk has the power and range that users might
rely upon to do the kinds of tasks performed by shell scripts. In this
-----------------------------------------
上面的一段文本是一本叫 《Sed&awk》 的书籍摘下来的,我的想法是这样的
因为我英文比叫差,长一点的单词就不认识了,我想对长一点的单词注中文解释。
我昨天整理了文本形式的单词库,在上面的文本 查找长度大于7的单词,然后将
长度 大于7 的单词与单词库a.txt比对。如果有这个单词的解释就加在这个单词所在的行
的下一行。效果如下。
-----------------------------------------------------------------
retrieval is the process of extracting data from a file and generating
retrieval n.取回, 恢复, 修补,重获,挽救,拯救
extracting 萃取, 提取, 提炼
generating 发生, 产生
a report.
The key to all of these operations is that the data has some kind of
operations n.运转, 操作, 实施, 作用, 业务, 工作, 手术, 军事行动
structure. Let us illustrate this with the analogy of a bureau. A bureau
structure 数据类型)结构,结构体
illustrate vt.举例说明, 图解, 加插图于, 阐明 vi.举例
----------------------------------------------------
单词库部分 a.txt
------------------------------------
retrieval n.取回, 恢复, 修补,重获,挽救,拯救
extracting 萃取, 提取, 提炼
generating 发生, 产生
operations n.运转, 操作, 实施, 作用, 业务, 工作, 手术, 军事行动
structure 数据类型)结构,结构体
illustrate vt.举例说明, 图解, 加插图于, 阐明 vi.举例
conditionals adj.有条件的, 引起条件反应的
multiple adj.多样的, 多重的 n.倍数, 若干 v.成倍增加
conditionals adj.有条件的, 引起条件反应的
manipulate vt.(熟练地)操作, 使用(机器等), 操纵(人或市价、市场), 利用, 应付
------------------------------------------------
先谢谢各位兄弟!!!
[ Last edited by guixi on 2007-10-26 at 11:58 PM ]
