How to get defined lines from OS X Terminal result?
The command you want is head

so for a command x and the first 20 lines you enter

x | head -n 20


This runs x and pipes the input into the head command.