我想像这样插入文本文件:(文本文件的内容不是这样的,这只是示例):
This Is The 1 line
This Is The 2 line
This Is The 3 line
This Is The 4 line
This Is The 5 line
This Is The 6 line
This Is The 7 line
This Is The 8 line
This Is The 9 line
This Is The 10 line
This Is The 11 line
This Is The 12 line
This Is The 13 line
This Is The 14 line
新文件将如下:
This Is The 1 line
This Is The 2 line
This Is The 3 line
This Is The 4 line
This Is The 5 line
This Is The 6 line
This Is The 7 line
This Is The 8 line
This Is The 9 line
This Is The 10 line
NEW INPUT HERE
This Is The 11 line
This Is The 12 line
This Is The 13 line
This Is The 14 line
我的问题是如何处理第1-10行,插入一些文本,以及后续处理第11-14行?
答案 0 :(得分:1)
这是一种强有力的方法:
这使用名为findrepl.bat
的助手批处理文件(由aacini提供) - 从以下网址下载:https://www.dropbox.com/s/rfdldmcb6vwi9xc/findrepl.bat
将findrepl.bat
放在与批处理文件相同的文件夹中或路径上。
@echo off
(
type "file.txt"|findrepl /o:1:10
echo NEW INPUT HERE
type "file.txt"|findrepl /o:11
) > "newfile.txt"