Connecting Tech Pros Worldwide Help | Site Map

remove newline character from field in exported table

Newbie
 
Join Date: Jul 2007
Posts: 11
#1: Jan 26 '09
I am trying to export the resultset of a query to a character delimited file. I am using the wizard for this. However, one of the fields is 512 characters long and it accepts from form address. It looks like the field contains newlines, but when i look at the resultset in DB2 i don't see any newline characters, only after i copy it and then paste it to notepad or textpad. When i export the table, this field contains several newline characters.
I am trying to resolve this. I have used tr in unix and it removed some of the newline characters but it does not seem to work. Does anyone have any ideas as how i can remove newlines from the export file?
Thanks.
MindBender77's Avatar
Familiar Sight
 
Join Date: Jul 2007
Location: Pittsburgh,Pa USA
Posts: 232
#2: Feb 5 '09

re: remove newline character from field in exported table


I have two questions. First, what is the "new line character"? Is it an actually character? If so, you could possibly do a "Find and Replace". Second, have you tried exporting the file to wordpad (.rtf)?

You could import the text file into say MS Access and remove the characters from there and re-export it back to a text file.


HTH,
Bender
Newbie
 
Join Date: Jul 2007
Posts: 11
#3: Feb 5 '09

re: remove newline character from field in exported table


yes, it is a newline character. The problem is that if i do a search and replace, i will be replacing the newline at the end of the line for the row that was exported and i don't want that. i just want to remove the newline character inside the string in the column. I am considering just doing a perl script for this.
Thanks.
Newbie
 
Join Date: May 2009
Posts: 3
#4: May 22 '09

re: remove newline character from field in exported table


Hi

I used following method

1) export the data in a delimited file.
2) Open the deleimited file using edit plus on windows.
3) the replace the new line character (\n) with nothing

and then import the data.
Reply