in grep command I can set max line to output with parameter -m. How I can specify max line in cat command ?
2 Answers
cat is dedicated to whole files.
You are looking for either head or tail, depending if your counting starts from the beginning or end of a file.
Examples
head --lines=100print the first 100 lineshead --lines=-100print all but the last 100 linestail --lines=100print the last 100 linestail --lines=-100print all but the first 100 lines
Note
You may also have a look at tac.
The result is clear, if you compare the word tac with cat.tac prints out all lines in reverse ordering.
Use head -n $NUMBER_OF_LINES instead of cat.
And watch out for useless uses of cat.