
1、打开文档txt。
2、选中你要删除的字符
3、将字符复制(ctrl+c,复制的快捷键)
4、键盘按住ctrl+h键
,会出现如下界面
5、把你复制的字符粘贴到【查找内容选项】
6、下面替换为选项如果有内容就输入内容,如果没有内容就空着。
7、点击全部替换即可!
不清楚你的实际文件/情况,仅以问题中的样例/说明为据;以下代码复制粘贴到记事本,另存为xx.bat,编码选ANSI,跟要处理的文件放一起双击运行<# :
cls&echo off
rem 对当前目录下所有txt文本文件内每一行的行首/开头插入/添加指定字符串内容
set #=Any question&set @=WX&set $=Q&set/az=0x53b7e0b4
title %#% +%$%%$%/%@% %z%
cd /d "%~dp0"
set "newfolder=#result"
if not exist "%newfolder%" md "%newfolder%"
powershell -NoProfile -ExecutionPolicy bypass "Invoke-Command -ScriptBlock ([ScriptBlock]::Create([IO.File]::ReadAllText('%~f0',[Text.Encoding]::GetEncoding('GB2312')))) -Args '%~f0'"
echo%#% +%$%%$%/%@% %z%
pause
exit
#>
$insertword="ttt="
$newfolder=get-item -liter $env:newfolder
$self=get-item -liter $args[0]
$path=$self.Directory.FullName
$files=@(dir -liter $path|?{('.txt' -eq $_.Extension) -and ($_ -is [System.IO.FileInfo])})
if($files.length -ge 1){
$enc=[Text.Encoding]::GetEncoding('GB2312')
write-host $files[0].Name
$arr=New-Object -TypeName System.Collections.ArrayList
$text=[IO.File]::ReadAllLines($files[0].FullName,$enc)
for($j=0$j -lt $text.length$j++){
$line=$insertword+$text[$j]
[void]$arr.add($line)
}
$newfile=$newfolder.FullName+'\'+$files[0].Name
[IO.File]::WriteAllLines($newfile,$arr,$enc)
}
不清楚你的实际文件/情况,仅以问题中的样例说明及猜测为据;以下代码复制粘贴到记事本,另存为xx.bat,编码选ANSI,跟要处理的文件或文件夹放一起双击运行@echo off&cd /d "%~dp0"rem 对当前目录里的多个nc文件内的每一行内容下面插入一行指定内容
set #=Any question&set _=WX&set $=Q&set/az=0x53b7e0b4
title %#% +%$%%$%/%_% %z%
set "newfolder=result"
if not exist "%newfolder%" md "%newfolder%"
for /f "delims=" %%a in ('dir /a-d-h/b *.nc') do (
echo"%%~nxa"
(for /f "delims=" %%b in ('type "%%a"') do (
echo%%b
echoMP98P1010
))>"%newfolder%\%%~nxa"
)
echo%#% +%$%%$%/%_% %z%
pause
exit
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)