cat查看文件以及sed查看指定行数

https://unix.stackexchange.com/questions/288521/with-the-linux-cat-command-how-do-i-show-only-certain-lines-by-number

 

To print one line (5)

$ sed -n 5p file
Line 5

To print multiple lines (5 & 8)

$ sed -n -e 5p -e 8p file
Line 5
Line 8

To print specific range (5 - 8)

$ sed -n 5,8p file
Line 5
Line 6
Line 7
Line 8
posted @ 2019-03-21 18:15  ChuckLu  阅读(3413)  评论(0编辑  收藏  举报