Solved

Carriage Return in Batch File

Posted on 2016-12-01
5
86 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 55

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 55

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 55

Expert Comment

by:Bill Prew
ID: 41909332
Welcome.
0

Featured Post

Why You Need a DevOps Toolchain

IT needs to deliver services with more agility and velocity. IT must roll out application features and innovations faster to keep up with customer demands, which is where a DevOps toolchain steps in. View the infographic to see why you need a DevOps toolchain.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You may have already been in the need to update a whole folder stucture using a script. Robocopy does it well and even provides a list of non-updated files in a log (if asked to). Generally those files that were locked by a user or a process by the …
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…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

724 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