How do I include a blank line between files I'm concatenating with “cat”?

前端 未结 5 1741
小鲜肉
小鲜肉 2020-12-16 14:14

I want to cat all the files in a directory, but include some spacer between each one.

5条回答
  •  醉梦人生
    2020-12-16 15:08

    echo "" > blank.txt
    cat f1.txt blank.txt f2.txt blank.txt f3.txt

    To handle all of the files in a Directory (assuming ksh like Shell)

    for file in * ; do
       cat $file >> result.txt
       echo "" >> result.txt
    done

提交回复
热议问题