Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uq: cannot save result to file | uq: 无法保存输出 #122

Open
Vinfall opened this issue Apr 20, 2024 · 1 comment
Open

uq: cannot save result to file | uq: 无法保存输出 #122

Vinfall opened this issue Apr 20, 2024 · 1 comment

Comments

@Vinfall
Copy link

Vinfall commented Apr 20, 2024

今天用 uq 删除 Windows PowerShell 历史记录中的重复行时遇到 uq 输出不能保存的问题(可以正常输出到 stdout)。

我尝试过的命令:

# 脚本中记录的用法
uq ConsoleHost_history.txt 1.txt
# pipe
cat ConsoleHost_history.txt | uq > 1.txt
# redirect
uq ConsoleHost_history.txt > 1.txt

可能的原因:编码问题,ConsoleHost_history.txt 使用的也是 UTF-8,EOL是CR LF

我使用 dos2unix 转换的时候报错,手动移除对应字符后正常转换。但是 uq 的输出还是不能保存,所以和编码估计没关系。

$ dos2unix 1.txt
dos2unix: Binary symbol 0x06 found at line 3700
dos2unix: Skipping binary file 1.txt

临时解决方案:使用 script 捕捉 uq 的输出,不知道为什么这个可以正常工作……

script output.txt
uq 1.txt
exit

运行完之后手动移除 output.txt 文件头尾的 script header 即可。

@lkun
Copy link

lkun commented Apr 20, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants