我有一个包含PBX电话长途交换信息的文本文件。 输入文件包含:批处理文件文本处理 - 查找连续号码
sourceNPA,srcNNX,DestinationNPA,destNNX
954,327,954,201
954,327,954,202
954,327,954,203
954,327,954,210
954,327,954,212
954,327,954,213
954,327,954,214
etc...
我不能使用任何但是VBS或Windows批次公司政策原因(不只是因为我不是一个编码器)。我预计会手动完成这些工作,但有43000或更多的转换成范围。
我需要读取给定文本文件的每一行,查看dNPA和dNXX(每行中的最后两个arg)是否连续,如果是这样,请确定范围,以便输入列表在输出中的内容如下所示:
954,327,954,201,203
954,327,954,210,210
954,327,954,212,214
etc...
我试过研究使用数组,并尝试读取一行到临时文件,但必须有一个技巧。
我一直修修补补,但有一点要说明的是:
@echo off
setlocal enabledelayedexpansion
set lineNumber=1
if exist outputFile.txt del outputFile.txt
for /f "tokens=1-6 delims=,;" %%a in (inputFile.txt) do call :process %%a %%b %%c %%d
:EOF
:process
set line!linenumber!SrcNPA=%1
set line!linenumber!SrcNNX=%2
set line!linenumber!destNPA=%3
set line!linenumber!destNNX=%4
REM then intended to compare the values but I'm stuck
REM I want to compare the last arugment of each line to the same
REM same argument in the next line read, and if its sequential
REM then set the start the range and when the comaparison is no longer
REM consecutive set the top of the range andn then write that range to output
set /a lineNumber+=1
我不清楚你想要达到什么目的。 – Marc
我需要处理一个文件,其中包含一列数字,其格式与第一个列出的连续数字相同,并输出格式与第二个数字列表格式相似的数字列表,其中输入中的连续数字转换为输出范围。 – James
代码示例很弱,但这就是为什么我要求提供建议。我尝试了几件事,但我认为我在这里追逐我的尾巴。 – James