Can I grep only the first n lines of a file?

后端 未结 11 1155
后悔当初
后悔当初 2021-01-30 07:33

I have very long log files, is it possible to ask grep to only search the first 10 lines?

11条回答
  •  死守一世寂寞
    2021-01-30 08:13

    grep -A 10

    This is to grab the pattern and the next 10 lines after the pattern. This would work well only for a known pattern, if you don't have a known pattern use the "head" suggestions.

提交回复
热议问题