Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Extra line feed

Status
Not open for further replies.

heidi88

Programmer
May 1, 2003
32
0
0
US
I have a file like this:

*NEW ZEALAND DOLLAR 0.6486 0.6506

NORWAY KRONE 6.6930 6.6750

SINGAPORE DOLLAR 1.7100 1.7059

SOUTH AFRICA RAND 6.3200 6.3750

How can I get rid of the extra line in between using vb script in DTS package. I know there is an extra line feed at end of each line.

Thanks a lot.
 
What do you have for code?

If you showed it, we will be able to guide you to the problem area(s).

The reason I'm asking this is because the solution is akin to a first quarter type problem. I will not give you the code but I will let you know that you should look at the VB help files for the following:

OPEN, LINE INPUT, TRIM, LEN, and CLOSE

Otherwise, post your code.
--MiggyD
 
I'm not that familiar with DTS low level stuff - is there a mechanism for skipping a record? You could then just check if the first field is empty - i.e.

If field1<>=&quot;&quot; then
<code to populate all fields and write record>
end if

Alternatively do you need to use DTS? Could you perhaps use the SQL command BULK INSERT and specify a ROWTERMINATOR that includes two line feeds - i.e. ROWTERMINATOR='\n\n' or similar (they may be carriage return/linefeed pairs.

Perhaps DTS allows you to specify a more complex delimiter in the same way?
 
I'm not that familiar with DTS low level stuff - is there a mechanism for skipping a record? You could then just check if the first field is empty - i.e.

If field1<>=&quot;&quot; then
<code to populate all fields and write record>
end if

Alternatively do you need to use DTS? Could you perhaps use the SQL command BULK INSERT and specify a ROWTERMINATOR that includes two line feeds - i.e. ROWTERMINATOR='\n\n' or similar (they may be carriage return/linefeed pairs).

Perhaps DTS allows you to specify a more complex delimiter in a similar way?
 
depending on how your code is set up, the general principal (if each line is in it's own variable/field/etc...) would be

dim sNewLine as string
sNewLine = left(sOldLine, len(sOldLine) -1)

sNewLine would be the new line without the extra feed, sOldLine is the line with the feed, and you'd basically just take everything starting from the left side up to the length of the string minus 1.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top