Solved

Carriage Return in Batch File

Posted on 2016-12-01
5
16 Views
Last Modified: 2016-12-01
I need to create a batch file that gets rid of the carriage return. The delimiter looks like a square [].

I attached what the file looks like and highlighted what I see the carriage return as and also another file what the expected output is ..

Any ideas how this can be accomplished
carriage-return.PNG
carriage-return---how-it-should-look.PNG
0
Comment
Question by:Shalver
  • 3
  • 2
5 Comments
 
LVL 51

Expert Comment

by:Bill Prew
ID: 41909304
Two things to try and see if it helps.  Either:

type filein.txt > fileout.txt

or

more filein.txt > fileout.txt

~bp
0
 

Author Comment

by:Shalver
ID: 41909311
I started something like this but it definitely is not correct !!!

@echo off
    setlocal enableextensions disabledelayedexpansion

    set "first=1"
    <nul (
      for /f "usebackq delims=" %%a in ("Carfinance2.txt") do (
        if defined first (set /p ".=%%a" & set "first=") else (set /p ".=,%%a")
      )
    ) >"output.txt"
0
 
LVL 51

Accepted Solution

by:
Bill Prew earned 500 total points
ID: 41909323
One other approach you can try is the following in a BAT script, although only if the first post I made doesn't.

If nothing suggested works then upload a sample of the file please.

for /f "tokens=*" %%A in ('type filein.txt') do (for /f "tokens=*" %%B in ("%%A") do (echo.%%B>>fileout.txt))

Open in new window

~bp
0
 

Author Closing Comment

by:Shalver
ID: 41909324
This solution worked ! Thank you very much
0
 
LVL 51

Expert Comment

by:Bill Prew
ID: 41909332
Welcome.
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

When you receive another warning that your shared drive is almost full and you have asked your users to clean out old files again and again, here is a single command that may help. This command will place all the files that have not been used rec…
Introduction: Recently, I got a requirement to zip all files individually with batch file script in Windows OS. I don't know much about scripting, but I searched Google and found a lot of examples and websites to complete my task. Finally, I was ab…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now