如何在 Windows 上反转文本文件

A. *_* D. 5 windows sorting

如何在保留空行的同时反转 .txt 文件的内容?

例如,

text one

text two
text three

text four


text five


text six
Run Code Online (Sandbox Code Playgroud)

会成为

text six


text five


text four

text three
text two

text one
Run Code Online (Sandbox Code Playgroud)

最好使用 Windows 控制台或源代码编译为应用程序。我有 Windows 7。

小智 10

这可以使用 PowerShell 轻松完成,无需任何其他工具:

$x = Get-Content -Path data.txt; Set-Content -Path data.txt -Value ($x[($x.Length-1)..0])
Run Code Online (Sandbox Code Playgroud)


A. *_* D. 2

我找到了完美的工具:tac(CoreUtils for Windows 的一部分)