I need to find all of the .csv files in a directory and append them (with these little breaks) into one large file. Why does this script only produce largefile.txt with the contents of the last file only? PS, I'm running on cygwin.
Code:
#!/bin/bash
# jcz 13-apr-08
##################################
echo " ******************************* "
echo " This script reads all csvs into a single file in this directory"
echo " ******************************* "
for filers in *.csv
do
echo "" >> largefile.txt
echo "" >> largefile.txt
echo "--------------------------------" >> largefile.txt
echo $filers >> largefile.txt
echo "--------------------------------" >> largefile.txt
cat $filers >> largefile.txt
done
Heh, found it as I was posting. The first append was a single so it was overwriting the file every loop.
The version above is fixed.