Empty line appears while merging different file contents in shell script

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  /home/ah5024331/d2  -type f -exec cat {} \; -exec echo \; > /home/ah5024331/op.txt

The 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 ----

--this is text from f2 ----
---this is new text from d2 ---

after file f1 contents,it adds one empty line. I want merged contents without any empty line in between . What are the changes I need to do in above command? Any help would be appreciated in advance.

user

Posted 2015-06-22T11:24:43.600

Reputation: 199

Answers

0

If running in Linux the below should work. Let me know in which Unix OS you are running this script.

find /home/ah5024331/f1 /home/ah5024331/f2  /home/ah5024331/d1  /home/ah5024331/d2 /home/ah5024331/f1 /home/ah5024331/f2  /home/ah5024331/d2  -type f -exec cat {} \; -exec echo -n "" \; > /home/ah5024331/op.txt

sureshraju

Posted 2015-06-22T11:24:43.600

Reputation: 141