在终端显示文本的中间部分

文本文件:text   

显示出19行到29行的部分。

1. head + tail

head text -n 29 | tail -n 11

2. sed

sed '19,29p' -n text

3. awk

awk 'NR == 19, NR == 29' text

4. cat + grep

cat -n text | grep -e '^\s*19\s' -e '^\s*2[0-9]\s'
posted @ 2012-06-17 13:04  Leo Forest  阅读(222)  评论(0编辑  收藏  举报