1
I have written shell script to merge different file's contents I have created directories f1,f2,d1,d2 and files under them , I need to merge all files's contents : comand is
(find /home/ah5024331/f1 /home/ah5024331/f2 /home/ah5024331/d1 /home/ah5024331/d2 /home/ah5024331/f1 /home/ah5024331/f2 -type f | xargs -i cat {} ) > t.txt
output is :
--this is new text from f1 ----
--this is text from f2 ------this is new text from d1 ------this is new text from d2 -----this is new text from f1 ----
I need to add new line after every end of file like:
--this is new text from f1 ----
--this is text from f2
------this is new text from d1
------this is new text from d2
-----this is new text from f1 ----
How to do that?
Any help would be appreciated in advance.


Why
echo "FOOBAR" >> t.txtand not justecho >> t.txt? – Arkadiusz Drabczyk – 2015-06-22T12:58:40.770Will not work with some files that already have a
\nat the end. This will create a double new line in some cases. To make it work perfectly you would have to remember last char placed in output and verify on switching to next file i think. – mnmnc – 2015-06-22T12:59:03.833From what I see she asked:
I need to add new line after every end of file like (...)– Arkadiusz Drabczyk – 2015-06-22T13:01:47.147@ArkadiuszDrabczyk ops, I misread the question. I'll simplify it as you suggested. Thanks for bringing this up. – jweyrich – 2015-06-22T13:02:10.997
I tried code its not adding new line after every file – user – 2015-06-22T13:33:08.350