bashgnu-findutils

How to add a new line (\n) between each file being concatenated


How should I modify this line to add a new line (\n) between each file being concatenated?

find /disk/data/source/* -name '*.xml' -exec cat {} \; > /home/userid/merged-file.xml

Solution

  • find accepts multiple -execs in one command. For example:

    find /disk/data/source/* -name '*.xml' -exec cat {} \; -exec echo "" \; > /home/userid/merged-file.xml