本帖最后由 CrLf 于 2012-7-17 18:57 编辑
纯批取列麻烦,但是读写文本很容易:- @echo off
- set _123456=01 02 03 04 05 07 08 09 10 12 13 14 16 17 19 22 23 24 25 26 28 29 30 31 33 34 35 37 38 40 43 44 45 46 47 49 50 51 52 54 55 56 58 59 61
- set _234567=07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
- set _17=06 27 48
-
- for %%a in (123456 234567 17) do (
- for /f "delims=" %%b in (a.txt) do (
- set "var=%%b"
- setlocal enabledelayedexpansion
- for %%c in (!_%%a!) do (
- set /a "n=5+(1%%c-100)*2"
- for %%d in (!n!) do set str=!str!!var:~%%d,2!
- )
- echo !var:~,7!!str!
- endlocal
- )
- )>%%a.txt
复制代码 vbs取列方便,但是读写文本很麻烦:- ar1 = Array(01,02,03,04,05,07,08,09,10,12,13,14,16,17,19,22,23,24,25,26,28,29,30,31,33,34,35,37,38,40,43,44,45,46,47,49,50,51,52,54,55,56,58,59,61)
- ar2 = array(07,08,09,10,11,12,13,14,15,16,17,18,19,20,21,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63)
- ar3 = array(06,27,48)
-
- Set FSO = CreateObject("Scripting.FileSystemObject")
-
- getColumn ar1,"123456.txt"
- getColumn ar2,"234567.txt"
- getColumn ar3,"17.txt"
-
- Sub getColumn(ar,filename)
- Set file = FSO.OpenTextFile("a.txt",1)
-
- Do While file.AtEndOfStream <> True
- n = Split(file.ReadLine)
- str = str & n(0)
- For Each a In ar
- str = str & " " & n(a)
- Next
- str = str & vbCrLf
- Loop
-
- file.Close
-
- Set file = FSO.CreateTextFile(filename,True)
- file.Write str
- file.Close
- End Sub
-
复制代码
|