简体   繁体   English

在文本文件中用CRLF替换CR的批处理脚本

[英]Batch script to Replace CR by CRLF in in text file

I Want to create batch script to replace carriage return(CR) by CRLF (carriage return and Line Feed).It should be use for other text file also, I can replace that in notepad++ but want to replace for more than 1 file so need to create a separate batch file which on execution replace that CR by CRLF. 我想创建批处理脚本以用CRLF替换回车符(CR)(回车符和换行符)。它也应用于其他文本文件,我可以在notepad ++中替换它,但要替换多个文件,因此需要创建一个单独的批处理文件,执行时将其替换为CRLF。 Can anyone help me out in these situation. 在这种情况下,谁能帮助我。

Thank You 谢谢

you can use notepad++ itself to mass replace 您可以使用notepad ++本身进行大量替换

open a command prompt type notepad++.exe -noseesion -r . 打开命令提示符,键入notepad ++。exe -noseesion -r

this will open all the files in a directory only without any files from previous session 这将仅打开目录中的所有文件,而没有上一个会话中的任何文件

hit ctrl+h and replace in all documents 按ctrl + h并替换所有文档

C:\massreplace>ls
001.bin                               001.txt  002.txt  004.txt
001.mysuperdupersecretsauceextension  001.yuk  003.txt  005.txt

C:\massreplace>"c:\Program Files\Notepad++\notepad++.exe" -nosession  -r *.*

C:\massreplace>

see in the screen shot below all the 8 files are open each files has 39 lines and 38 lines have CRLF i replaced all 38*8 = 304 CRLF with LF by hitting REPLACE all in all opened documents 在下面的屏幕快照中看到,所有8个文件都已打开,每个文件有39行,而38行具有CRLF,我可以通过在所有打开的文档中全部按REPLACE键将所有38 * 8 = 304 CRLF替换为LF

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM