|
发表于 2010-8-17 22:25:21
|
显示全部楼层
好像原书中的答案!?
If you try to read this data using the default FS and RS variable values, gawk will read each line
as a separate record, and interpret each space in the record as a field separator. This isn’t what
you intended.
To solve this problem, you need to set the FS variable to the newline character. This indicates
that each line in the data stream is a separate field and all of the data on a line belongs to the
data field. However, now you have the problem of not knowing where a new record starts.
To solve this problem, set the RS variable to an empty string, then leave a blank line between data
records in the data stream. The gawk program will interpret each blank line as a record separator. |
|