shellunixcat

Unix cat to output only range of rows


How can I get output of cat command to show me only output from 85 to 158 line of the file.
I know I can add the numbers to each lime and then maybe pipe it, but I don't want to delete numbers latter.

Or should I maybe use some other text parser? Thanks.


Solution

  • You can use sed:

    sed -n '85,158p' file
    

    or

    head -n 158 file | tail -n 73 # 158-85=73