Importing with more that one cr/lf in line… | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Importing with more that one cr/lf in line…

Hi, I have a txt file that contains a cr/ln at the end of each header, detail, and trailer. I’m trying to import using dts, and have specified that i will determine the end of records which is at location 750. but the dts only lets me get to the header cr/lf at position 180. any suggestions?
Can you change the export specs at the source to add a text delimiter (typically a double-quote)? DTS should support text delimiters – could depend on the source type you’ve chosen.
I’m getting the txt from an outside source. have no control over how they export.

Are the any free txt editors that i could open up the txt file in and then do a replace with….? Word? Excel?
Notepad.
Luis Martin
Moderator
SQL-Server-Performance.com One of the symptoms of an approaching nervous breakdown is the belief that one’s work is terribly important
Bertrand Russell
All postings are provided “AS IS” with no warranties for accuracy.
I recommend ultraedithttp://www.ultraedit.com
UEDIT supports search and replace of ‘tokens’ such as ^p meaning end of line However, I have to say my personal choice would be to preprocess the file before importing. Maybe by writing a small bespoke software, maybe a perl script, c++, maybe even using T-SQL itself (less performance, but nice and seamless) Is this just a one off import? Im sure you dont want to be running a text editor every time you get a new data feed
For a command line replace utility you can use tr.exe:
http://unxutils.sourceforge.net/ Run tr –help for details. I used it to replace double line breaks in import files.
]]>