[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖
  1. @echo off
  2. rem 注意将代码中的两处字符串替换为文本中的整行,包含行首、尾空格(如有)。
  3. (for /f "useback delims=" %%a in ("1.txt") do (
  4. if "%%a" equ "delete(Array.prototype.p);" (
  5. goto :next
  6. )
  7. if defined n (
  8. echo %%a
  9. )
  10. if "%%a" equ "Array.prototype.p = Array.prototype.push;" (
  11. set n=1
  12. )
  13. ))>"2.txt"
  14. :next
  15. pause
复制代码
bat小白,请多指教!谢谢!

TOP

回复 5# kidzgy


   参考2楼代码第2行。
bat小白,请多指教!谢谢!

TOP

test.html
  1. var D = dirs;
  2. Array.prototype.p = Array.prototype.push;
  3. D.p(["D:/quest2*0*1680711711*D:/quest2/","CastReceiver_1.5.6_armeabi-v7a_by_Prosmart.by.apk*12505115*1618494146","SKYBOX v1.1.0.465.apk*140533455*1680486331","SKYBOX VR Video Player [1.1.0.525].apk*121507878*1647912077","ssrray-release-3.8.10.1.apk*36174974*1621004286",310721422,"1"])
  4. D.p(["D:/quest2/adb*0*1633840967","aapt.exe*1639424*1619405894","aapt_20210426105805.exe*1639424*1619405894","adb.exe*1974272*1619405894","adb_20210426105805.exe*1974272*1619405895","AdbWinApi.dll*97792*1619405894","AdbWinApi_20210426105805.dll*97792*1619405894","AdbWinUsbApi.dll*62976*1619405894","AdbWinUsbApi_20210426105808.dll*62976*1619405895",7548928,""])
  5. delete(Array.prototype.p); // remove alias added above
  6. $(document).ready(function(){
复制代码


code2
  1. @echo off
  2. chcp 65001 >nul
  3. rem 批处理保存为utf-8编码格式
  4. set "str1=Array.prototype.p = Array.prototype.push;"
  5. set "str2=delete(Array.prototype.p);"
  6. for /f "tokens=1 delims=:" %%a in ('^<"test.html" findstr /n /c:"%str1%" /c:"%str2%"') do (
  7. if not defined s (
  8. set s=%%a
  9. ) else (
  10. set e=%%a
  11. )
  12. )
  13. (for /f "tokens=1* delims=:" %%a in ('^<"test.html" findstr /n .') do (
  14. if %%a gtr %s% if %%a lss %e% (
  15. echo=%%b
  16. )
  17. ))>"out.html"
复制代码
bat小白,请多指教!谢谢!

TOP

本帖最后由 77七 于 2023-8-6 17:14 编辑

文本行超长,批处理处理不了。要是我自己用的话,可以用第三方工具,linex和cfile ,都可以通过行号打印超长文本行。
打印第100行及接下来的10行
type 1.txt|linex -l 100 -e 10
linex -l 100 -e 10 <1.txt >2.txt
打印第100-110行
cfile 100,110 1.txt >2.txt
大概是这样。
bat小白,请多指教!谢谢!

TOP

返回列表