last line in text is catr return/line feed

November 16, 2010 at 00:00:32
Specs: Windows XP
Use the following command to combine
tmp1.txt and tmp2.txt into FINAL.txt

copy tmp1.txt+tmp2.txt FINAL.txt

for /f "delims=" %%i in ('FINAL.txt^|find /c /v "" ') do set count=%%i
echo total of records is %count%

The total of count is incorrect, because have additional line.
Open the FINAL.txt,noticed that carriage return/line feed is included.

How to remove it? in order to get the total of count is corrected. Thanks!



See More: last line in text is catr return/line feed

Report •


#1
November 16, 2010 at 00:07:05
@echo off > newfile & setLocal enableDELAYedeXpansion

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


=====================================
Life is too important to be taken seriously.

M2


Report •

#2
November 16, 2010 at 00:30:20
Thanks for your reply. I try the following add in FINAL.txt, the carriage return is still there.

@echo off > newfile & setLocal enableDELAYedeXpansion

set N=
for /f "tokens=* delims= " %%a in ('FINAL.txt) do (
set /a N+=1
>> newfile echo.%%a
)
echo.!N!

the output of the newfile is (command -> more FINAL.txt)

FH20100805123000000158
P1000002POS SG BERHAD(OKR)
C1000005MITSI-SO (M) SDN. BHD
C1000016MAC TRANS SDN BHD
FT000001000000000000018


Please advice
thanks




Report •

#3
November 16, 2010 at 02:02:16
So you ran this command, roght?

more FINAL.txt

And what?


=====================================
Life is too important to be taken seriously.

M2


Report •

Related Solutions

#4
November 16, 2010 at 02:08:30
after run the command

more FINAL.txt

the following detail is displayed

FH20100805123000000158
P1000002POS SG BERHAD(OKR)
C1000005MITSI-SO (M) SDN. BHD
C1000016MAC TRANS SDN BHD
FT000001000000000000018




Report •


Ask Question