?
Solved

Carriage Return in Batch File

Posted on 2016-12-01
5
Medium Priority
?
96 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 56

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 56

Accepted Solution

by:
Bill Prew earned 2000 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 56

Expert Comment

by:Bill Prew
ID: 41909332
Welcome.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
If like me you are one who spends a lot of time working and scripting with cmd.exe, sometimes it is handy to be able to quickly view a calendar for a given month and year. This script will quickly do just that!  Save the code posted below to a .bat …
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

764 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