批处理“删除小于8位大于24位的文本行”代码

问:有一个字典需要整理一下,需要将删除小于8位大于24位的文本行删除,如何用批处理解决?

解决办法:

将下面的代码保存为 *.bat 格式的文件,如pop.bat,然后双击运行,实例命令如下:

@echo off
setlocal enabledelayedexpansion
cd.>newfile.txt
for /f "delims=" %%i in (file.txt) do (
set text=%%i
if "!text!" neq "!text:~0,7!" if "!text!"=="!text:~0,24!" echo %%i>>newfile.txt
)

执行命令后,如果没有newfile.txt的文本文档出现,请刷新一下桌面。

This entry was posted in Technology and tagged , . Bookmark the permalink. 2,397 views

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>