For example, 1.txt is as follows. Copy content to clipboard
Code :
111111111111111111111 98912 Zhang San
222222222222222222 150020 Li Si
333333333333333333333 360000 Wang Wu
444444444444444444 2332 Zhao liu6
555555555555555555 Tian Qi
666666666666666666666 Dance Bar output through batch processing: copy the content to the clipboard code:
111111111111111111111 98912 Zhang San
222222222222222222 150020 Li Si4
333333333333333333333 360000 Wang Wu
444444444444444444 2332 Zhao liu6
555555555555555555 Tian QI
222 WUBA Code Requirements, no temporary files are generated.
the code is concise, and points can be added based on the train of thought and code!
layout
this article only provides a simple text layout through batch processing, and requires the code to be generic. As the Batman moderator said, it will be a tedious process, therefore, to solve the problem, you do not have to consider the general use of the code.
silent: copy Code the code is as follows: @ echo off
setlocal enabledelayedexpansion
set n = 0
for/F "tokens = 1, 2 *" % I in (1.txt) do (
set "Ke = % I % J"
set m = 0
call: 1
)
for/F "tokens = 1, 2 *" % I in (1.txt) do (
set "ke1 = % I % J"
set ke2 = % I
set M1 = 0
call: 2
echo! Ke2! % J % K
)
pause
Goto: EOF
: 1
if not "! KE :~ % M %, 1! "=" "Set/a m + = 1 & GOTO 1
If % m % gtr % N % set n = % m %
Goto: EOF
: 2
If not "! Ke1 :~ % M1 %, 1! "=" "Set/A M1 + = 1 & goto 2
Set/A dd= n-m1
For/L % A in (1,1, % DD %) do set "ke2 =! Ke2! "
Goto: EOF
BATMAN:Copy codeThe Code is as follows: @ echo off & setlocal enabledelayedexpansion
Set "Kong ="
For/F "delims =" % A in (1.txt) Do (
For % I in (% A) Do (
Set "str = % I" & set/A N + = 1
If! N! Equ 2 (
Set "str = % Kong %! Str! "
Set/P =! STR :~ -10! <NUL
) Else (
Set "str =! Str! % Kong %"
Set/P =! STR :~, 20! <NUL
))
Set "n = 0" & Echo.
)
Pause> NUL
More:Copy codeThe Code is as follows: @ echo off
Setlocal enabledelayedexpansion
For/F "tokens = 1, 2 *" % A in ('Type temp.txt ') Do (
Set "mo = % A" & set "niu = % B" & set "m = 0" & set "n = 0" & set "very ="
Call: ming0 % A % B % C
)
Echo. & pause & Exit
: Ming0
If not "! MO :~ % M %, 1! "=" "(Set" momo =! MO :~ % M %, 1! "& Set/a" m + = 1 "& Goto: ming0)
: Ming1
If not "! Niu :~ % N %, 1! "=" "(Set" niuniu =! Niu :~ % N %, 1! "& Set/a" N + = 1 "& Goto: ming1)
Set/a "Ming = 30-% m %-% N %"
For/L % I in (1 1% Ming %) do set "very =! Very! "
Echo % 1% very % 2% 3
523066680:Copy codeThe Code is as follows: @ echo off
Mode con Cols = 100 lines = 20
Setlocal enabledelayedexpansion
For/L % A in (1, 1, 80) do set Kong =! Kong!
For/F "EOL = tokens = 1, 2, 3" % A in ('Type 1.txt ') Do (
Set lie1-2 = % A % B % Kong %
Set lie1-2 =! Lie1-2 :~ 0, 80!
Set lie1-2 = %! Lie1-2: % A % B =! % B
Echo ,! Lie1-2! % C
)
Pause
Principle: for example, the text content is:
AB ****** 1 * d
ABC *************** 2 ********** E
Use for to obtain the first two columns
Directly combining removes spaces in the middle:
Ab1
Abc2
Add 80 spaces.
Ab1 ***************************......
Abc2 ***************************......
Save the first 80 bits.
Ab1 *********...... ***
Abc2 ********...... ***
Move spaces forward
AB *********...... * ** 1
ABC ********...... * ** 2
In this way, the front is basically aligned. Not to mention the third column...
I think it should be okay ...... At least I don't use it too commonly, and I haven't used this code myself as a tool.