I'm trying to use bash to read data from several one line text files, each in its own directory, and spit them out into one master file, each on a new line.
The data of my input file is structured like so ;
Store# online backoffice win7
I'm looping through each directory with find and cat the file contents to a variable. The problem is I can't seem to get each pass to put the data on a newline. Here is my code;
#!/bin/bash
#Find all sites
stores=$(find /home/sites*/ -maxdepth 0)
for store in $stores; do
final=${final}$(cat ${store}\processors.txt)"\n"
done
printf "${final}" > ~/master.txt
What I get in the master file is
Store# online backoffice win7Store# online backoffice win7