CSV file with delimiter other than comma
Moderators: chulett, rschirm, roy
CSV file with delimiter other than comma
Is it possible to create a CSV file with the delimiter other than comma. If its possible, can anybody let me know the option to be used and the delimiter?
Thanks..
Thanks..
Gopinath
In the sequential file "Format" tab, select Field defaults -> Delimiter to be a value other than the default "comma".
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
If you specify other than comma, its creating file with incorrect values. Please see the example below.ArndW wrote:In the sequential file "Format" tab, select Field defaults -> Delimiter to be a value other than the default "comma". ...
Input:
col1 col2 col3
ABC A,B ABC
Output should be like below,
col1 col2 col3
ABC A,B ABC
My output file is CSV file hence we cannot give other than comma as a delimiter.
Output with delimiter as comma: If i give comma, its created like below,
col1 col2 col3
ABC A B ABC
Output with delimiter other than comma: If you give other than comma as a delimiter, then its giving like,
col1 col2 col3
ABC A
Gopinath
Since your problem lies in having embedded commas, you need to ensure that your strings are quoted when writing to the sequential file.
CSV files do not need to have commas as separators, quite of semicolons are used and theoretically any separator could be used.
what did you specify as your separator instead of a comma? That is not evident from your example.
CSV files do not need to have commas as separators, quite of semicolons are used and theoretically any separator could be used.
what did you specify as your separator instead of a comma? That is not evident from your example.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
I am trying to use PIPE as delimiter.ArndW wrote:Since your problem lies in having embedded commas, you need to ensure that your strings are quoted when writing to the sequential file.
CSV files do not need to have commas as separators, quite of semicolons are used and theoretically any separator could be used.
what did you specify as your separator instead of a comma? That is not evident from your example.
I have tried pipe as delimiter and used the Quote function too. But the output is not generating as expected.
Note: I cannot get my input with Quote and my output file shud be a CSV file.
Gopinath
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Writing 3 column values of "x" "y,y," and "z" in a pipe delimited file with double quotes results in:
When you read this using pipe delimiters and double-quotes for strings you will get exactly the same results.
Code: Select all
"x"|"y,y"|"z"
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
-
- Premium Member
- Posts: 457
- Joined: Tue Sep 25, 2007 4:05 pm
First off, a csv is a "Comma separated values" file. On Unix, you can create files with any name (.csv or .out etc.). But, if you import that into Windows to view it, you cannot immediately open with Excel. You have to use a text editor.
That is exactly what was suggested here. Even if this gets created with quotes, when you read it again in a sequential file stage with the proper settings, you should not be seeing those quotes again. The problem is that you have fields with commas as values and you have to use quotes to treat that as one. You can even use a comma as a delimiter if you are using double quotes.Gopinath wrote: I cant get my input with Quotes, its coming from many source tables and after transformations, writing into a sequential file as CSV file.
Vivek Gadwal
Experience is what you get when you didn't get what you wanted
Experience is what you get when you didn't get what you wanted