CSV file

I am new to script writing. With the help of others I now have a script that reads the files names in a folder and records each file name in a comma delimited file. "import.txt".

I can now import this into Open office Calc as a TextCSV file but it places each file name at the head of a separate column.

What I really want is to be able to import the file such that it shows each file name in a separate row but in the 1 column.

It seems to me I need some how to put a return. line feed or carriage return in where the , is in the script.

How do I do this?

I known one can do an Edit cut and the a special paste in a way that transposes the data base from a single long row of data and to a single column but this is messy for the numbers I have to do. So if it can be done in the generation of the CSV file it would be a lot beter and easier.

I am using OpenOffice 3.3, and Fedora 14 64 bit as the OS

The current script in the area where the comma is is

"$LINE," >> import.txt: done.

This works fine for what I want but it gives the end results as I say with the file name one per column when importing as comma delimited.

Thanks

Reverse the process :

fill up filenames in a column in an Open Office file
save it as csv
transfer in binary to your unix machine, and edit the file with

vi yourfile.csv

press <Esc> key to make sure you are in command mode
then
:se list
this will make vi display <tab> or "\r" keys into readable caracter ^I ^M

You will then be able to see what character you need to add into the file you want to generate so you can make it fit the Open Office csv format.

to exit vi, just use the following seqence (still in command mode)
:q!

Thanks for the reply. I generated a file as you suggested and looked at the readable character it put in to the TextCSV file the showed up as "bread"$ where the $ was coloured blue. There was a $ characters after every line so when I tried in import it again I have all the names listed in a single column with each on a different row.

So I tried to change the text file I had generated with the files names in it. The $ was just put in as a $ straight from the key board (just in black) but when the text files was imported using TextCSV into open office all the file names were in one row and one column.

Clearly the $ was not being recognised as a control character.

Do not quite know where to go from here

if you don't mind can i give a simple solution for that..

take tha file name as a variable and add it to the file it self as first column or last column and print the file.

then it will give your our put.

you try it..
or else i wil give the code..

regards
rajesh

The $ you see just means "end of line" so you don't need to add these.
to go back to display in a normal way use :

:se nolist (still in vi command mode)

You must just make sure that the file you want to generate with your script look like the one you have edited with vi.

1) Could you please provide your all code ?

maybe try something like:

echo "$LINE," >> import.txt

2) or :

cd folder
ls -1 | sed 's/$/,/' >>import.txt