Joining every group of N lines into one with bash

后端 未结 2 1822
孤街浪徒
孤街浪徒 2020-12-07 02:09

I would like to join every group of N lines in the output of another command using bash.

Are there any standard linux commands i can use to achieve this?

Exa

2条回答
  •  孤街浪徒
    2020-12-07 02:44

    Seems like you're trying to join every two lines with the delimiter \t(tab). If yes then you could try the below paste command,

    command | paste -d'\t' - -
    

    If you want space as delimiter then use -d,

    command | paste -d' ' - -
    

提交回复
热议问题