close

小的檔案可以用 cat, 或 vim

超大檔案如果只看特定行數可以搭配 sed

 

1. 列出第五行

$ sed -n 5p file

2. 列出第五行, 第八行

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

3. 列出第五到第八行

$ sed -n 5,8p file

4.列出第五到第八行, 和第十行

$ sed -n -e 5,8p -e 10p file

 

 

Reference:

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

arrow
arrow
    全站熱搜

    kk 發表在 痞客邦 留言(0) 人氣()