- 论坛徽章:
- 0
|
hi,最近在看sed&awk第二版本,第6.1.1中有一个例子,如下:
cat testfile6
Consult Section 3.1 in the Owner and Operator
Guide for a description of the tape drives
available on your system.
Look in the Owner and Operator Guide shipped with your system.
Two manuals are provided including the Owner and
Operator Guide and the User Guide.
The Owner and Operator Guide is shipped with your system.
目的:要将文本中出现的所有跨行或不跨行的 Owner and Operator Guide替换成Installation Guide
我写的语句:
sed "/Owner/ {N;s/Owner *\n*and *\n*Operator *\n*Guide/Installation Guide\n/g}" testfile6
结果是只将第一、二处替换成功,第三、四处没有替换。结果如下:
Consult Section 3.1 in the Installation Guide
for a description of the tape drives
available on your system.
Look in the Installation Guide
shipped with your system.
Two manuals are provided including the Owner and
Operator Guide and the User Guide.
The Owner and Operator Guide is shipped with your system.
请问原因是? |
|