[ale] help with a tiny shell script

Geoffrey esoteric at 3times25.net
Tue Nov 16 08:08:34 EST 2004


jay wrote:
> Here's the scoop...I have about 330 csv files that are results files from a 
> survey.  I want to import them into a spreadsheet for graphing, but when 
> coding the survey in php, my partner and I didnt place a line break after 
> each results file finishes.  
> 
> The result is 330 files like this: 
> 
> 2,0,0,1,1,3,1,10,2,0,2,1,1,0,	*	"short answer" 
> 
> Each file is one line, with a set of comma deliminated numerical answers, then 
> one short answer question, separated by the star as you see above.  What I 
> want to do is basically: 
> 
> cat *.csv > append.csv 

for fn in *.csv; do
cat $fn
echo
done > output

OR

for fn in *.csv; do
sed 's/$/\n/' $fn
done > output

-- 
Until later, Geoffrey



More information about the Ale mailing list