CopyCode The Code is as follows: @ echo off
Goto run
The problem is that there is a text file with the following content:
Accident
N. accidents, accidents; accidents (factors)
Across
Prep. Crossed, crossed; opposite ad. Crossed, crossed
Active
Active, agile, and active; active
Advertise
Vt. Announcement, announcement; advertisement for... vi. Advertisement
After
Prep. In... later; In... after adv. Later
How can I put it in another file with the following content:
Accident N. accidents, accidents; accidents (factors)
Across prep. Crossed, crossed; crossed across ad. Crossed, crossed
Active. Active, agile, and active.
Advertise vt. Announcement; advertisement for... vi. Advertisement
After prep. After...; after adv. After
General Solution:
@ Echo off
: Code by JM 2006-9-21 cmd @ XP
Set/a num = 1
Setlocal enabledelayedexpansion
For/F "tokens = *" % I in (1.txt) Do (
Set/a num + = 1
Set/A mod =! Num! % 2
If! Mod! Equ 1 (set Var = % I) else (set STR = % I)
If! Mod! Equ 1 echo! Str! ! VaR!
)
Pause
Goto: EOF
The simplest and most efficient solution:
: Run
@ Echo off
: Code by 3742668 2006-9-21 cmd @ XP
Setlocal enabledelayedexpansion
For/F "delims =" % I in (1.txt) Do (
If "! Str! "=" "(Set STR = % I
) Else (
Echo! Str! % I
Set STR =
)
)
Pause