请问如何删除TXT文档中每行中前20字符
删除前2011-11-2417:32:56DLL(IK_ID_OPENUSER)->CARD:411524199305080010,Validate:02011-11-2...
删除前2011-11-24 17:32:56 DLL(IK_ID_OPENUSER)->CARD:411524199305080010, Validate:0
2011-11-24 17:45:45 DLL(IK_ID_OPENUSER)->CARD:411524199305080010, Validate:0
2011-11-24 17:57:36 DLL(IK_ID_OPENUSER)->CARD:413026198310280335, Validate:0
2011-11-24 18:07:07 DLL(IK_ID_OPENUSER)->CARD:411524199106032710, Validate:0
2011-11-24 18:09:04 DLL(IK_ID_OPENUSER)->CARD:411524199309070012, Validate:0
2011-11-24 18:24:55 DLL(IK_ID_OPENUSER)->CARD:413027197401020039, Validate:0
删除后DLL(IK_ID_OPENUSER)->CARD:411524199305080010, Validate:0
DLL(IK_ID_OPENUSER)->CARD:411524199305080010, Validate:0
DLL(IK_ID_OPENUSER)->CARD:413026198310280335, Validate:0
DLL(IK_ID_OPENUSER)->CARD:411524199106032710, Validate:0
DLL(IK_ID_OPENUSER)->CARD:411524199309070012, Validate:0
DLL(IK_ID_OPENUSER)->CARD:413027197401020039, Validate:0 展开
2011-11-24 17:45:45 DLL(IK_ID_OPENUSER)->CARD:411524199305080010, Validate:0
2011-11-24 17:57:36 DLL(IK_ID_OPENUSER)->CARD:413026198310280335, Validate:0
2011-11-24 18:07:07 DLL(IK_ID_OPENUSER)->CARD:411524199106032710, Validate:0
2011-11-24 18:09:04 DLL(IK_ID_OPENUSER)->CARD:411524199309070012, Validate:0
2011-11-24 18:24:55 DLL(IK_ID_OPENUSER)->CARD:413027197401020039, Validate:0
删除后DLL(IK_ID_OPENUSER)->CARD:411524199305080010, Validate:0
DLL(IK_ID_OPENUSER)->CARD:411524199305080010, Validate:0
DLL(IK_ID_OPENUSER)->CARD:413026198310280335, Validate:0
DLL(IK_ID_OPENUSER)->CARD:411524199106032710, Validate:0
DLL(IK_ID_OPENUSER)->CARD:411524199309070012, Validate:0
DLL(IK_ID_OPENUSER)->CARD:413027197401020039, Validate:0 展开
1个回答
展开全部
把下面代码用记事本保存为xx.bat 放在那txt文件同位置运行(假定文件名a.txt)则删去每行前20字符 :
@echo off
set fn=a.txt
(for /f "usebackq delims=" %%i in ("%fn%")do (
echo;%%i>con
set "h=%%i"
setlocal enabledelayedexpansion
echo;!h:~20!
endlocal))>b.txt
move b.txt "%fn%"
pause
不过换一种规则更好,就是把每行第二处空格前的去掉:
@echo off
set fn=a.txt
(for /f "usebackq tokens=2*" %%i in ("%fn%")do (
echo;%%j>con&echo;%%j
))>b.txt
move b.txt "%fn%"
pause
@echo off
set fn=a.txt
(for /f "usebackq delims=" %%i in ("%fn%")do (
echo;%%i>con
set "h=%%i"
setlocal enabledelayedexpansion
echo;!h:~20!
endlocal))>b.txt
move b.txt "%fn%"
pause
不过换一种规则更好,就是把每行第二处空格前的去掉:
@echo off
set fn=a.txt
(for /f "usebackq tokens=2*" %%i in ("%fn%")do (
echo;%%j>con&echo;%%j
))>b.txt
move b.txt "%fn%"
pause
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询