delete the last caracter for each line of the generated file

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
mkatih
Posts: 1
Joined: 10 Feb 2020 03:05

delete the last caracter for each line of the generated file

#1 Post by mkatih » 10 Feb 2020 03:19

Hello all :) ,

I have a DOS Batch that export data from an application,

After this export I get a ".csv" that end by a semicolon,

I want to delete this semicolon for each line,

Thanks in advance,

penpen
Expert
Posts: 1859
Joined: 23 Jun 2013 06:15
Location: Germany

Re: delete the last caracter for each line of the generated file

#2 Post by penpen » 11 Feb 2020 07:58

If your DOS Batch exports the data, just change that part of the code that prints the line and avoid the semicolon at the end of the line or remove it:

Code: Select all

:: sample code removing the last character of a line in environment variable
set "line=Test line;"
echo(%line:~0,-1% 
penpen

Squashman
Expert
Posts: 4193
Joined: 23 Dec 2011 13:59

Re: delete the last caracter for each line of the generated file

#3 Post by Squashman » 11 Feb 2020 08:33

mkatih wrote:
10 Feb 2020 03:19
Hello all :) ,

I have a DOS Batch that export data from an application,

After this export I get a ".csv" that end by a semicolon,

I want to delete this semicolon for each line,

Thanks in advance,
Please show us the code you are already using so we are not guessing at any possible solutions to your problem.

Post Reply