我可以在命令行上用 Windows 行结尾替换 Unix 行结尾吗?
Can I replace Unix line endings with Windows line endings on the commandline?
我正在摆弄 hg log
命令将 mercurial 消息存储在一个文件中,例如这个(为便于阅读而断开的行):
hg log --template "Rev. {rev} from {date|rfc822date}:
\r\n--------------------------------------------
\r\n\t{desc|strip|fill68|tabindent}\r\n\r\n\r\n" > hglog.txt
问题出在 fill68
过滤器,它在 68 个字符后换行。理论上,也就是因为那些换行符是Unix换行符,在记事本中是不会显示的。
有没有办法将 \n
替换为 \r\n
,通过管道将 hg log
的输出通过另一个命令传递?
我希望 运行 在自动 VS post 构建脚本中执行此命令,因此我无法手动执行此操作。
从 Windows 您可以调用 MORE
命令作为指定 here:
hg log ... | more /p > hglog.txt
我正在摆弄 hg log
命令将 mercurial 消息存储在一个文件中,例如这个(为便于阅读而断开的行):
hg log --template "Rev. {rev} from {date|rfc822date}:
\r\n--------------------------------------------
\r\n\t{desc|strip|fill68|tabindent}\r\n\r\n\r\n" > hglog.txt
问题出在 fill68
过滤器,它在 68 个字符后换行。理论上,也就是因为那些换行符是Unix换行符,在记事本中是不会显示的。
有没有办法将 \n
替换为 \r\n
,通过管道将 hg log
的输出通过另一个命令传递?
我希望 运行 在自动 VS post 构建脚本中执行此命令,因此我无法手动执行此操作。
从 Windows 您可以调用 MORE
命令作为指定 here:
hg log ... | more /p > hglog.txt