Cynosure.X International

: :

Add Comment | Related Links | TrackBack
Related Content

EOLtoCSV.sh (GPL)

EOLtoCSV.sh is a Bourne shell script that converts values delimited by new line characters into comma separated values. The following before and after table shows what this script does. EOLtoCSV.sh accepts the list through stdin and outputs the result to stdout.

BeforeAfter
dog
cat
mouse
dog,cat,mouse

EOLtoCSV.sh is distributed as executable source code under the GNU General Public License. Please see the license agreement elsewhere on this site.

Example Usage

cat list.txt | EOLtoCSV.sh > newlist.txt

Attached File: EOLtoCSV.sh (214 B)

Chieh Cheng
Tue, 16 Oct 2007 01:00:20 +0000

After a full year, while writing my new "EOL Converter.sh" script, I've realized that I uploaded a bad version of EOLtoCSV.sh above. I don't know how that happened. Why didn't anybody tell me? :-P The one that I attached below is the good version. Please download and use the one below, instead.

By the way, if you have any blank lines in the input, it will be converted to comma separated value (CSV) as well. This is not a bug, it's semantically correct, because you might have empty value fields. The following is an example.

BeforeAfter
dog

cat
mouse
dog,,cat,mouse

If you don't want the blank lines to be converted, you can use the free StripBlankLines.class Java utility to convert it, before piping your data in this EOLtoCSV.sh script. You can download the StripBlankLines.class utility elsewhere on this site. The following command is an example of this situation:

cat list.txt | java StripBlankLines | EOLtoCSV.sh > newlist.txt

Attached File: 1 - EOLtoCSV.sh (223 B)

Chieh Cheng
Thu, 20 Nov 2008 20:37:11 +0000

Add Comment | Related Links | TrackBack
Related Content

Did your message disappear? Read the Forums FAQ.

Add Comment

Spam Control | * indicates required field
Your Name: *
E-mail:
Remember Me!
Comment: *
File attachment is optional. Please do not attach a file to your submission unless it is relevent.
Attach File:
(20 MB Max)
Spam Protection: * Answer of 4 - 2?
Click button only once, please!

TrackBack

Send Ping | TrackBack URL | Spam Control

No TrackBacks yet. TrackBack can be used to link this thread to your weblog, or link your weblog to this thread. In addition, TrackBack can be used as a form of remote commenting. Rather than posting the comment directly on this thread, you can posts it on your own weblog. Then have your weblog sends a TrackBack ping to the TrackBack URL, so that your post would show up here.

Messages, files, and images copyright by respective owners.

Products | Services
Forums | Latest | RSS
Library | Search | Wiki
Help | Licenses

Login | Register

12 Users Online

Hacking Digital Cameras
Fun for Photographers


Amazon Associate

Copyright © 1996 - 2017. All Rights Reserved.