What's the opposite of head? I want all but the first N lines of a file

前端 未结 8 679
时光说笑
时光说笑 2020-12-07 19:55

Given a text file of unknown length, how can I read, for example all but the first 2 lines of the file? I know tail will give me the last N lines, but

8条回答
  •  南方客
    南方客 (楼主)
    2020-12-07 20:10

    I really don't know how to do it from just tail or head but with the help of wc -l (line count) and bash expression, you can achieve that.

    tail -$(( $( wc -l $FILE | grep -Eo '[0-9]+' ) - 2 )) $FILE

    Hope this helps.

提交回复
热议问题