Computing.Net > Forums > Windows XP > Bat file to delete carriage returns

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Bat file to delete carriage returns

Reply to Message Icon

Name: foundbobby
Date: July 16, 2007 at 16:35:40 Pacific
OS: Windows XP
CPU/Ram: 1024 MB of RAM
Product: Dell Dimension 2350
Comment:

Hi,

I have to submit a UPS manifest every day which requires a long TXT full of shipping information to be sent to them.

The old computer I was using had a special program to do it, but my new one just grabs the file via FTP and then resends it to UPS. Unfortunately UPS needs all of the data on one line.

Is there any way to replace ALL carriage returns within a file with a "space" or possibly just to delete them? Any/all hope will be greatly appreciated.

Thank you!

Robert Fischer.



Sponsored Link
Ads by Google

Response Number 1
Name: jefro
Date: July 16, 2007 at 16:52:20 Pacific
Reply:

I have looked at that issue a dozen times without any simple answer. I'd like to know it.

The only way I know of is to run it in a binary file editor and get them out that way. Used to be able to do it from a command line on an old OS. There are some VB script out that that may work. Some pages show a way to use a text editor but I have had little luck with that.

I read it wrong and answer it wrong too. So get off my case you goober.


0

Response Number 2
Name: Mechanix2Go
Date: July 16, 2007 at 17:23:19 Pacific
Reply:

@echo off > newfile
setLocal EnableDelayedExpansion

for /f "tokens=* delims= " %%a in (myfile) do (
set s=!s!%%a
)
echo !s! >> newfile



=====================================
If at first you don't succeed, you're about average.

M2



0

Response Number 3
Name: Razor2.3
Date: July 16, 2007 at 18:19:21 Pacific
Reply:

VBScript may be better if you can't have a line return at the end or if the file is around 8K+:

With CreateObject("Scripting.FileSystemObject")
Set fOut = .CreateTextFile("newfile", True)
With .OpenTextFile("myfile", 1, False)
Do Until .AtEndOfStream
fOut.Write .ReadLine
Loop
End With
End With


0

Response Number 4
Name: foundbobby
Date: July 17, 2007 at 08:27:12 Pacific
Reply:

This is regadarding Mechanix2

It seems to work for 8KB but the file I am working with is a 250,000 character TXT file.

Is there any way you could have it work with a file of this size?

thank you thank you!!

Robert

>@echo off > newfile
>setLocal EnableDelayedExpansion
>for /f "tokens=* delims= " %%a in (myfile) >do (
>set s=!s!%%a
>)
>echo !s! >> newfile

Robert Fischer.


0

Response Number 5
Name: foundbobby
Date: July 17, 2007 at 08:29:42 Pacific
Reply:

Sorry, I am unfamiliar with how to run or manipulate VB script. Is it possible to make an executable out of it?

Thank you very much,

Robert

Robert Fischer.


0

Related Posts

See More



Response Number 6
Name: Razor2.3
Date: July 17, 2007 at 19:39:52 Pacific
Reply:

1) Save the colored text as whatever.vbs
2) Replace the red colored text with the relevant information. In this case, the first one is the output file name, and the second is the source name. (They cannot be the same.)
3) Run it! Do it either from a batch file (whatever.vbs), or straight up (double-click on the icon). If you run it from a batch file, the batch will wait for the VBScript to end, so you don't have to worry about that.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Strange problem with Exce... some installers reboot co...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Windows XP Forum Home


Sponsored links

Ads by Google


Results for: Bat file to delete carriage returns

modify bat file to delete directory www.computing.net/answers/windows-xp/modify-bat-file-to-delete-directory/167071.html

bat files that delete folders on C: www.computing.net/answers/windows-xp/bat-files-that-delete-folders-on-c/114070.html

create bat file to purge log file www.computing.net/answers/windows-xp/create-bat-file-to-purge-log-file/179854.html