hlzj88 当前离线
少校
@echo on&&setlocal enabledelayedexpansion for /f "tokens=1 delims=:" %%i in ('findstr /n "楼主" 33.txt') do ( echo 楼主标志的行号 %%i set /a xy=%%i+1 set js= for /f "delims=" %%m in ("33.txt") do ( set /a js+=1 if !xy!==!js! echo %%m>>44.txt echo 标准!xy! 计数!js! ) ) pause复制代码
aloha20200628 当前在线
上尉
@echo off for %%n in (2,4,8,10) do set "[%%n]=%%n" &::建立伪数组 [n]=n 对应行序号 set "n=0" &setlocal enabledelayedexpansion (for /f "delims=" %%s in (33.txt) do ( set/a "n+=1" &for %%k in (!n!) do set "An=![%%k]!" if !An! equ !n! echo,%%s ))>44.txt复制代码
TOP
WHY 当前离线
上校
grep -P -A1 --no-group-separator ">楼主(:)?<" a.txt | grep -P -v ">楼主(:)?<" | find /v "" > b.txt复制代码
评分人数
qixiaobin0715 当前离线
大校
@echo off set n=0 setlocal enabledelayedexpansion (for /f "delims=" %%i in (33.txt) do ( if !n! equ 1 echo,%%i set "str=%%i" if not "!str:>楼主=!"=="!str!" (set n=1) else set n=0 ))>44.txt pause复制代码
fzp070 当前在线
三级士官
terse 当前离线
中将
powershell "(select-string -Lit '%~dp0a.txt' -pattern '>楼主:?<' –context 1 ).Context.PostContext" >a_a.txt复制代码
powershell "(select-string -Lit '%~dp0a1.txt' -pattern '>楼主:?<' –context 1 -Encoding default).Context.PostContext" >a_1.txt复制代码
select-string -Lit 'e:\[文本处理] 提文求助:取\a1.txt' ...... 复制代码
powershell "(select-string 'a.txt' -pattern '>楼主:?<' –context 1).Context.PostContext" >a11.txt powershell "(select-string 'a.txt' -pattern '>楼主:?<' –context 1 -Encoding default ).Context.PostContext" >a_#.txt复制代码
“C:\Windows\System32\WindowsPowerShell\v1.0\a.txt”复制代码
select-string : 找不到路径“C:\Windows\System32\WindowsPowerShell\v1.0\a.txt”,因为该路径不存在。 所在位置 行:1 字符: 2 + (select-string 'a.txt' -pattern '>楼主:?<' –context 1).Context.PostCont ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (C:\Windows\Syst...hell\v1.0\a.txt:String) [Select-String], ItemNotFound Exception + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.SelectStringCommand 复制代码