Board logo

标题: [文本处理] bat 怎么删除文本文件的重复字符 [打印本页]

作者: hentai87    时间: 2020-6-4 21:14     标题: bat 怎么删除文本文件的重复字符

本帖最后由 hentai87 于 2020-6-4 21:27 编辑

1.txt
Containers-ApplicationGuard-Package~31bf3856ad364e35~amd64~en-US~10.0.19640.1.mum
Containers-ApplicationGuard-Package~31bf3856ad364e35~amd64~~10.0.19640.1.mum
Containers-OptionalFeature-DisposableClientVM-Package~31bf3856ad364e35~amd64~en-US~10.0.19640.1.mum
Containers-OptionalFeature-DisposableClientVM-Package~31bf3856ad364e35~amd64~~10.0.19640.1.mum

删除~后面的文本
然后得到
Containers-ApplicationGuard-Package
Containers-ApplicationGuard-Package
Containers-OptionalFeature-DisposableClientVM-Package
Containers-OptionalFeature-DisposableClientVM-Package
最终要求
Containers-ApplicationGuard-Package
Containers-OptionalFeature-DisposableClientVM-Package
作者: Batcher    时间: 2020-6-4 21:39

回复 1# hentai87
  1. @echo off
  2. (for /f "delims=~" %%i in ('type "1.txt"') do (
  3.     if not defined %%i (
  4.         echo,%%i
  5.         set %%i=1
  6.     )
  7. ))>"2.txt"
复制代码





欢迎光临 批处理之家 (http://bbs.bathome.net/) Powered by Discuz! 7.2