- 论坛徽章:
- 9
|
关于n命令 sed awk 101 hacks中是这样说的:
The sed n command lets you change that flow. The sed n command
will print the current pattern space, clear the current pattern space,
read the next line from the input-file, and continue the command
flow.
Let us assume that you have 2 sed commands before and 2 after the
n command as shown below.
sed-command-1
sed-command-2
n
sed-command-3
sed-command-4
In this case, sed-command-1 and sed-command-2 will be applied to
the current line in the pattern space; when sed encounters the n
command, it will clear the current line from the pattern space, read
the next line from the input-file, and apply sed-command-3 and sedcommand-
4 to this newly read line in the sed pattern space.
在实际试验中
sed -n n employee.txt 假如n有打印功能的话,为什么这里什么也不打印?
sed n employee.txt 假如n没有打印功能的话,这里为什么会打印所有行而不是偶数行? |
|