newline not work with my csv
1 Attachment(s)
Hi,I have a file,content as below:
a b c d and I want insert the content into a csv form,and used the "echo ,,`cat file`, >file.csv" but the csv form turns out to be as below: Attachment 12175 Can anyone help to make the newline work,and keep the format as the file shows,not shows in one line. |
Hi,
what about the following: Code:
sed 's/$/,/g' < file > file.csv Evo2. |
1 Attachment(s)
Quote:
|
Hi,
Quote:
Code:
cat --show-nonprinting file.csv |
You need to embed the text in double quotes. The below was tested in a windows environment and shows how you can embed newlines (double quotes highlighted in bold red) as well as commas in csv fields.
csv file Code:
"a Code:
+----+-------------+ unless within double quotes, newlines indicate the end of the records; similar, commas indicated the end of a field |
Quote:
[ssh@Nick sf_osshare]$ cat --show-nonprinting t.csv ,,a b c d, HI,nothing different |
Hi,
I thought that Wim's post was the answer... Quote:
Evo2. PS. Please use [code] tags where appropriate. |
Quote:
|
All times are GMT -5. The time now is 04:19 AM. |