1.cat -s filename
2.[xxxx@localhost test]$ sed -e '/^$/{
> $!N
> /^\n$/D
> }' filename
$!N:对最后一行不进行(N)操作,也就是出来最后一行的意思
man sed:
n N Read/append the next line of input into the pattern space.
D Delete up to the first embedded newline in the pattern space.
Start next cycle, but skip reading from the input if there is
still data in the pattern space.
阅读(703) | 评论(0) | 转发(0) |