Creating c.s.v. files. How ?

  • Thread starter Thread starter John Fitzsimons
  • Start date Start date
J

John Fitzsimons

Hi,

Suppose I have a text file of "x" columns of 30 characters. What
program could I use to convert the text to a c.s.v. file ? How to do
it would also be handy. TIA.

Regards, John.
 
Tiger said:
CSVdb

Should do it...but I've not tried *exactly* what you're trying.

Both CSVdb and DBedit will deal with (read and convert) the files
if those columns are separated by tabs... It was quite a while
before I realized that, as the steps are indirect for both progs.

If the columns are separated by spaces, then all I'd know to do
is run a separate program, text editor or a standalone search &
replace tool, before loading them into a csv editor.

Is this the nature of the request, having a csv editor read the
files? Or is it something else wanted, as in the line of batch
conversion of a number of files? In such a case, it seems the
dirction to take would be a search & replace tool....
 
Both CSVdb and DBedit will deal with (read and convert) the files
if those columns are separated by tabs... It was quite a while
before I realized that, as the steps are indirect for both progs.

re: dbEdit - this is how I do it

- copy the tabular data to the clipboard
- open dbEdit
- then from the drop down file menu select: open from clipboard
- save the results as a .csv file

dbEdit has some size limitations - it doesn't sound as if that would be
a problem in this case . . .

Susan
--
Pricelessware: http://www.pricelessware.org
PL2003: http://www.pricelessware.org/2003/about2003PL.htm
PL2004 Review: http://www.pricelessware.org/2004/2004nominationsPL.php
alt.comp.freeware FAQ (short) - maintained by John F.
http://clients.net2000.com.au/~johnf/faq.html
 
Susan Bugher said:
re: dbEdit - this is how I do it

- copy the tabular data to the clipboard
- open dbEdit
- then from the drop down file menu select: open from clipboard
- save the results as a .csv file

That's how I do it, too. Once I finally realized it could be done.
dbEdit has some size limitations - it doesn't sound as if that would be
a problem in this case . . .

Yes, send it too large a file, and it hangs, hidden, so you have to get out
a procman to kill it. I nevertheless keep it as my preferred default .CSV
viewer. Then when I have a large file, or have some involved processing to
do on the file, I send that to CSVdb.

In CSVdb, I open the file, which sometimes it might initially display funky,
depending on what type of settings were activated during my previous launch.
Then on the "Modify" options tab at the bottom of the screen, where it says
"set separator," I choose "tab." Last, I go to the File Menu, and choose
"Refresh File." This lets me view and work with it in tab-separted form.

To save it as csv at this point, I again use the "Modify" options tab, and
the "set separator" checkbox, changing that choice to "comma." Then the
Save/Save As dialog honors that choice when doing the save.

The preferred method could be using the "Import" routine in CSVdb, on its
File menu. The first screen, you choose the file to import, together with
the filename you want for export (the export filename can be the same or
different). Hmmmmmmm. I swear I've used it successfully in the past...
Yet trying now, there's something I'm overlooking, something CSVdb (v4.41)
doesn't like about my test files, or something other, don't know what...
 
John said:
Hi,

Suppose I have a text file of "x" columns of 30 characters. What
program could I use to convert the text to a c.s.v. file ? How to do
it would also be handy. TIA.

There is a program I use that will do it, but I'll only mention it (and
the method used) if such objective information, the type I always give
in ACF in reference to *this* type of software, is not going to be
labelled as some sort of "hero worship" ... particularly after the event
and/ or out of its context.

Your call.
 
| There is a program I use that will do it, but I'll only mention it (and
| the method used) if such objective information, the type I always give
| in ACF in reference to *this* type of software, is not going to be
| labelled as some sort of "hero worship" ... particularly after the event
| and/ or out of its context.
|
| Your call.

Alan ....

If the data was well formatted, I would probably write a small Python program
for converting a text file into a CSV file, but you've piqued my curiousity
as to what you have in mind ....

If you don't want to post the info here,
my eMail address is real ....
 
Cousin Stanley said:
| There is a program I use that will do it, but I'll only mention it (and
| the method used) if such objective information, the type I always give
| in ACF in reference to *this* type of software, is not going to be
| labelled as some sort of "hero worship" ... particularly after the event
| and/ or out of its context.
|
| Your call.

If the data was well formatted, I would probably write a small Python program
for converting a text file into a CSV file, but you've piqued my curiousity
as to what you have in mind ....

If processing a number of files was what John was actually after, that
sounds pretty cool. Maybe just write it up regardless? I, for one, would
set my download manager to gobble it down without hesitation. :)
If you don't want to post the info here,
my eMail address is real ....

My speculative guess is that Alan figures that if John already has Excel,
that this is the tool that will perform the function most efficiently.
 
| If processing a number of files was what John was actually after,
| that sounds pretty cool. Maybe just write it up regardless?
| I, for one, would set my download manager to gobble it down
| without hesitation.
| ....

Cousin Karen ....

I hope I didn't mislead you,
as I should have stated ...

I would probably write a small Python program
for converting THAT SPECIFIC text file into a CSV file ....

Although Python is a VERY useful programming language
and the latest version, Python 2.3, has a csv module,
it would be difficult to come up with an algorithm
that would be useful for text ---> csv file conversion
in general ....

However, solutions to problems like John F. posed
should be readily solvable in Python and adaptable,
through a bit a program tweaking if the user is Python savy,
to other similar cases where the input text files
to be converted are structured in a similar manner ....
 
If processing a number of files was what John was actually after, that
sounds pretty cool. Maybe just write it up regardless? I, for one, would
set my download manager to gobble it down without hesitation. :)

Yes, having had experience of Cousin Stanley's programming I could say
with certainty that it would be well programmed.
My speculative guess is that Alan figures that if John already has Excel,
that this is the tool that will perform the function most efficiently.

Knowing Alan's hero worship of anything Microsoft you may well be
right. Excel however isn't freeware.

Regards, John.
 
On Sat, 15 Nov 2003 23:32:14 -0500, Susan Bugher

re: dbEdit - this is how I do it
- copy the tabular data to the clipboard
- open dbEdit
- then from the drop down file menu select: open from clipboard

Thank you. Yes, I had forgotten that approach. Even though I have used
it before.
- save the results as a .csv file
dbEdit has some size limitations - it doesn't sound as if that would be
a problem in this case . . .

Not in this case. Though the hanging of dbEdit on large files is a
major irritation.

That's one of the reasons I probably forgot that option. It only works
sometimes. :-(

Regards, John.
 
Cousin said:
If the data was well formatted, I would probably write a small
Python program for converting a text file into a CSV file, but
you've piqued my curiousity as to what you have in mind ....

If you don't want to post the info here,
my eMail address is real ....

Hi CS

I don't know enough about Python's capabilities to comment on that. Not
the solution I had in mind, but I know that I could use *another*
scripting language (the mention of which would be synonymous with "hero
worship") that could accept user inputs indicating how the file should
be analysed. You might be able to accommodate this kind of flexibility
in yours.

Anyway, I won't pursue this here for the benefit of JF because you can
see from his reply what I'm up against (see "Standard footer for John
Fitzsimons" in my reply to his post for a better picture). He has a
habit of turning round and biting the hand that feeds him, once he's got
someone to do his work for him. This time I decided to test the water
before putting any time & effort into helping him and, sure enough, the
bait was snapped up as expected. His expertise appears to be shooting
himself in the foot.

Can you imagine such an unbiased "keeper of the FAQ" becoming an
impartial moderator of a proposed moderated ACF?
 
John said:
Knowing Alan's hero worship of anything Microsoft you may well be
right. Excel however isn't freeware.

Such a pity you're not interested in the information then. It would have
probably been exactly the method you were after, and probably usable in
non-hero software too. Your choice though - incredible as it is. Still,
I guess it's not the first time you've managed to alienate yourself from
potential benefit, by standing firm on your own shakey and untenable
ground.

__ Standard footer for John Fitzsimons __
(quoted from numerous replies to his posts) ...

-------------DO NOT SNIP--------------
I think this is about the fifth or sixth time I've asked you to supply
any reference to any post I've made, which would serve to back up your
allegations of "worship*". Or if that's too hard, any thread at all I've
started off by actually recommending using a MS product (worshipping not
even required). Each time you have conveniently snipped the request from
your reply. Let's see if you can manage to do it again, or whether you
can actually put your money where your mouth is.
-------------DO NOT SNIP--------------

* or your new little catchword "hero" if you prefer.
 
you would have "tab" characters between the columns
replace all "tab" by "comma" (word can do that) and you have
comma-separated-values (cvs)
 
I don't know enough about Python's capabilities to comment on that. Not
the solution I had in mind, but I know that I could use *another*
scripting language

Now you got me curious. What other scripting language are you
referring to?
 
Vic said:
Now you got me curious. What other scripting language are you
referring to?
It could be done with:
awk
sed
perl
ed
ex
python
lex (yes, really!!) (Okay, it's not a scripting language.)
vim (and other "vi" clones)

You could probably do it in "bash", but I'm not really a bash hacker, I
just use it as an interactive shell, I script in "sh", and you could
_almost_ do it in "sh", and maybe in "csh" and "ksh" too.

Cheers,
Gary B-)
 
It was a dark and stormy night when "Gary R. Schmidt"
It could be done with:
awk
sed
perl
ed
ex
python
lex (yes, really!!) (Okay, it's not a scripting language.)
vim (and other "vi" clones)

You could probably do it in "bash", but I'm not really a bash
hacker, I just use it as an interactive shell, I script in "sh",
and you could _almost_ do it in "sh", and maybe in "csh" and "ksh"
too.

My guess is that Alan is thinking in using WSH, you know, the script
engine developed by Microsoft. Still I think the best tool here is
awk as it has been developed specifically to process text.

Regards
 
John said:
Hi,

Suppose I have a text file of "x" columns of 30 characters. What
program could I use to convert the text to a c.s.v. file ? How to do
it would also be handy. TIA.

Regards, John.

Maybe HABFiles comes in handy:
http://www.hotkey.net.au/~hambar/habit/habutil.htm

It can handle both fixed width files and delimited files
(quotes and commas or plain commas).

And it lets you restructure and reformat and solve various problems.

There is also the dos program txt2csv (much more limited) :

ftp://ftp.sunet.se/pub2/pc/mirror/simtelnet/msdos/database/txt2csv.zip
 
Both CSVdb and DBedit will deal with (read and convert) the files
if those columns are separated by tabs...

Separated by tabs? If that's the case you can simply copy and paste
the text into a spreadsheet such as OpenOffice and save the result as
csv.
 
Back
Top