[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
- <!--x-content-type: text/plain -->
- <!--x-date: Tue Nov 16 00:55:20 2004 -->
- <!--x-from-r13: puevfgbcure ng oretreba.pbz (Quevfgbcure Pretreba) -->
- <!--x-message-id: [email protected] -->
- <!--x-reference: [email protected] --> "http://www.w3.org/TR/html4/loose.dtd">
- <!--x-subject: [ale] help with a tiny shell script -->
- <li><em>date</em>: Tue Nov 16 00:55:20 2004</li>
- <li><em>from</em>: christopher at bergeron.com (Christopher Bergeron)</li>
- <li><em>in-reply-to</em>: <<a href="msg00692.html">[email protected]</a>></li>
- <li><em>references</em>: <<a href="msg00692.html">[email protected]</a>></li>
- <li><em>subject</em>: [ale] help with a tiny shell script</li>
rm append.csv
echo > append.csv
for i in `cat *.csv`; do cat $i >> append.csv; echo -e "\n" >>
append.csv; done
Basically what this will do is:
a) remove any existing append.csv file that you have (I'm assuming
that's what you want)
b) create an empty file called append.csv (optional step; just added for
robustness)
c) for each .csv file, cat it into append.cvs and then echo a newline
after it
I've just started learning AWK and I have a feeling that it might be
better suited for this, but you asked how to do it in bash.
I'd be interested to know how others would do this though - particularly
because sed has some nasty quirks when it comes to newlines.
Best regards,
CB
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
>
>but I want to add a linebreak between each file. I can code this in python,
>but that seems unnecessarily complicated, and I'm almost positive if I knew
>how to utilize the shell better, I could do this in one command....can anyone
>shed some light on this for me?
>
>Thanks!
>
>-Jay
>_______________________________________________
>Ale mailing list
>Ale at ale.org
><a rel="nofollow" href="http://www.ale.org/mailman/listinfo/ale">http://www.ale.org/mailman/listinfo/ale</a>
>
>
>
</pre>
<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->
<hr>
<ul><li><strong>Follow-Ups</strong>:
<ul>
<li><strong><a name="00694" href="msg00694.html">[ale] help with a tiny shell script - correction</a></strong>
<ul><li><em>From:</em> christopher at bergeron.com (Christopher Bergeron)</li></ul></li>
<li><strong><a name="00695" href="msg00695.html">[ale] help with a tiny shell script</a></strong>
<ul><li><em>From:</em> jloden at toughguy.net (Jay Loden)</li></ul></li>
</ul></li></ul>
<!--X-Follow-Ups-End-->
<!--X-References-->
<ul><li><strong>References</strong>:
<ul>
<li><strong><a name="00692" href="msg00692.html">[ale] help with a tiny shell script</a></strong>
<ul><li><em>From:</em> jloden at toughguy.net (jay)</li></ul></li>
</ul></li></ul>
<!--X-References-End-->
<!--X-BotPNI-->
<ul>
<li>Prev by Date:
<strong><a href="msg00692.html">[ale] help with a tiny shell script</a></strong>
</li>
<li>Next by Date:
<strong><a href="msg00694.html">[ale] help with a tiny shell script - correction</a></strong>
</li>
<li>Previous by thread:
<strong><a href="msg00692.html">[ale] help with a tiny shell script</a></strong>
</li>
<li>Next by thread:
<strong><a href="msg00694.html">[ale] help with a tiny shell script - correction</a></strong>
</li>
<li>Index(es):
<ul>
<li><a href="maillist.html#00693"><strong>Date</strong></a></li>
<li><a href="threads.html#00693"><strong>Thread</strong></a></li>
</ul>
</li>
</ul>
<!--X-BotPNI-End-->
<!--X-User-Footer-->
<!--X-User-Footer-End-->
</body>
</html>