How to get some specific lines from huge text file in unix?

前端 未结 3 602
悲哀的现实
悲哀的现实 2021-02-01 20:34

I use importing systems based on delimited text files. The files used can sometimes be almost 2 Gb big and I have to check some lines from that file. So I want to know how ca

3条回答
  •  日久生厌
    2021-02-01 21:08

    You can do this with many Unix tools, for instance with awk:

    # print first 5 lines with awk
    awk 'NR>=1&&NR<=5{print}NR>=6{exit}' file
    
    # print selection of lines 
    awk 'NR==994123||NR==1002451||NR==1010123{print}NR>1010123{exit}' file
    

提交回复
热议问题