Append to same line in Bash

前端 未结 4 1986
一个人的身影
一个人的身影 2021-02-20 06:50

The file letters.csv contains:

b,a,c,

The file numbers.csv contains:

32
34
25
13

I would like to append numbe

4条回答
  •  误落风尘
    2021-02-20 07:28

    You can use tr:

    cat letters.csv numbers.csv | tr '\n' ',' | sed 's/,$/\n/'
    

    (I hope this is not a useless use of cat. :-))

    The sed at the end is needed to replace the last , with a newline character.

提交回复
热议问题