Read n lines at a time using Bash

前端 未结 15 2793
难免孤独
难免孤独 2020-11-30 00:25

I read the help read page, but still don\'t quite make sense. Don\'t know which option to use.

How can I read N lines at a time using Bash?

15条回答
  •  一整个雨季
    2020-11-30 01:08

    to read n+2 Lines from a file:-

    2

    4

    6

    8

    .

    .

    so on

    you can try this way:-

    cat fileName | awk '!((NR - 0) % 2)'

提交回复
热议问题