Page 1 of 2
Add Line to txt batch
Posted: 22 Jul 2014 23:38
by cumhur_28
Hi Again;
thanx for your help for other question. it solved
i have another problem to solve.
i have txt file like
3453432432
6542312332
i need output file like that for each line
xxxxxxxx_01|3453432432
xxxxxxxx_02|6542312332
Please Help;
Regards.
CUMHUR
Re: Add Line to txt batch
Posted: 24 Jul 2014 08:39
by cumhur_28
is there any idea??
Re: Add Line to txt batch
Posted: 24 Jul 2014 09:27
by Aacini
Code: Select all
@echo off
setlocal EnableDelayedExpansion
set i=100
for /F "delims=" %%a in (theFile.txt) do (
set /A i+=1
echo xxxxxxxx_!i:~-2!^|%%a
)
Re: Add Line to txt batch
Posted: 04 Aug 2014 05:13
by cumhur_28
Aacini wrote:Code: Select all
@echo off
setlocal EnableDelayedExpansion
set i=100
for /F "delims=" %%a in (theFile.txt) do (
set /A i+=1
echo xxxxxxxx_!i:~-2!^|%%a
)
thank you my friend.
when i use this bat it gives result in dos screen i need in txt file.
thanx for your help
regards
cumhur
Re: Add Line to txt batch
Posted: 04 Aug 2014 07:25
by Squashman
cumhur_28 wrote:when i use this bat it gives result in dos screen i need in txt file.
Remember this part of code from your last batch file.
http://www.robvanderwoude.com/redirection.php
Re: Add Line to txt batch
Posted: 04 Aug 2014 13:05
by cumhur_28
thanx for your quick reply and sorry for my english when i added end of my batch file it gives %a.
and i doing something wrong
Re: Add Line to txt batch
Posted: 04 Aug 2014 13:09
by cumhur_28
@echo off
setlocal EnableDelayedExpansion
set i=100
for /F "delims=" %%a in (theFile.txt) do (
set /A i+=1
echo xxxxxxxx_!i:~-2!^|%%a
)
>>"newfile.txt" echo %%a
Re: Add Line to txt batch
Posted: 04 Aug 2014 13:37
by Compo
cumhur_28 wrote:>>"newfile.txt" echo xxxxxxxx_!i:~-2!^|%%a
Re: Add Line to txt batch
Posted: 04 Aug 2014 14:17
by cumhur_28
thanx for your help finally you did it.
this forum is the best for batch's
thanx
cumhur
Re: Add Line to txt batch
Posted: 04 Aug 2014 14:40
by Squashman
cumhur_28 wrote:@echo off
setlocal EnableDelayedExpansion
set i=100
for /F "delims=" %%a in (theFile.txt) do (
set /A i+=1
echo xxxxxxxx_!i:~-2!^|%%a
)
>>"newfile.txt" echo %%a

Re: Add Line to txt batch
Posted: 05 Aug 2014 00:14
by cumhur_28
Squashman wrote:cumhur_28 wrote:@echo off
setlocal EnableDelayedExpansion
set i=100
for /F "delims=" %%a in (theFile.txt) do (
set /A i+=1
echo xxxxxxxx_!i:~-2!^|%%a
)
>>"newfile.txt" echo %%a

i promise this is my last question when i used this batch i will has two space end of the all lines.
how can i remove?
thanx
cumhur
Re: Add Line to txt batch
Posted: 05 Aug 2014 02:51
by foxidrive
You have trailing or incorrect spaces in your batch file or in the text file.
Trim space characters problem
Posted: 06 Aug 2014 07:50
by cumhur_28
Hi;
i have txt files like.
Code: Select all
xxxxxxxx_01|54545454548488
xxxxxxxx_02|89494984694964
each end of the line has 2 space character and some program generates and i wont reach that to change it.
i want to remove this space character.
and i want to show this file in new txt file.
pls help
thanx
cumhur
Re: Trim space characters problem
Posted: 06 Aug 2014 08:05
by Squashman
I am going to move this question to your previous thread because it looks to be related to your previous thread.
Re: Trim space characters problem
Posted: 06 Aug 2014 08:35
by cumhur_28
Squashman wrote:I am going to move this question to your previous thread because it looks to be related to your previous thread.
thank you my friend