From sed documentation:
d Delete the pattern space; immediately start next cycle.
What does the next cycle mean ? I understand that sed will not use the following commands, which, after the d command , will begin to read the next line from the input stream and process it. But that doesn't seem to be true. See this exam:
[root@localhost ~]
aaaaaaaaaaaaaa$
$
bbbbbbbbbbbbb$
$
$
ccccccccc$
ddd$
$
eeeeeee$
[root@localhost ~]
aaaaaaaaaaaaaa
aaaaaaaaaaaaaa
aaaaaaaaaaaaaa
bbbbbbbbbbbbb
bbbbbbbbbbbbb
bbbbbbbbbbbbb
ccccccccc
ccccccccc
ccccccccc
ddd
ddd
ddd
eeeeeee
eeeeeee
eeeeeee
[root@localhost ~]
If the next loop starts immediately , the p command will not output.
Can anyone help me explain this please? Thank.
source
share