bashsearchgrep

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


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


Solution

  • The magic of pipes;

    head -10 log.txt | grep <whatever>