重定向到文件会在 Powershell 中添加额外的返回值吗?

发布于 2024-12-08 17:15:18 字数 900 浏览 1 评论 0原文

以下想要对输出进行换行:

ss "Call Info-.*66000" *1006*.log -Context 2,2 > ../test.txt

为什么?

ssSelect-String 的别名。

有没有办法让它不向数据添加换行符?

编辑: 当它得到类似的东西时:

... 80 characters ... This line is too long 55000
... 80 characters ... This line is too long 55000
... 80 characters ... This line is too long 66000
... 80 characters ... This line is too long 44000
... 80 characters ... This line is too long 40000

它会产生类似的东西:

  ... 80 characters ... 
This line is too long 55000
  ... 80 characters ... 
This line is too long 55000
> ... 80 characters ... 
This line is too long 66000
  ... 80 characters ... 
This line is too long 44000
  ... 80 characters ... 
This line is too long 40000

在输出文件中?!?!?!?!?我可以理解换行到屏幕,但是文件呢?这太奇怪了。 (日志文件实际上看起来与此完全不同,其中一些行长达数百个字符。)

The following wants to line wrap the output:

ss "Call Info-.*66000" *1006*.log -Context 2,2 > ../test.txt

Why?

ss is a alias for Select-String.

Is there a way to make it not add linebreaks to the data?

Edit:
When it gets something like:

... 80 characters ... This line is too long 55000
... 80 characters ... This line is too long 55000
... 80 characters ... This line is too long 66000
... 80 characters ... This line is too long 44000
... 80 characters ... This line is too long 40000

it produces something like:

  ... 80 characters ... 
This line is too long 55000
  ... 80 characters ... 
This line is too long 55000
> ... 80 characters ... 
This line is too long 66000
  ... 80 characters ... 
This line is too long 44000
  ... 80 characters ... 
This line is too long 40000

IN THE OUTPUT FILE?!?!?!?!? I can understand wrapping to the screen but the file? That's just bizarre. (The log file actually looks nothing like this and some of the lines are hundreds of chars long.)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

好听的两个字的网名 2024-12-15 17:15:18

尝试做:

select-string "Call Info-.*66000" *1006*.log -Context 2,2 | set-content ..\test.txt

Try doing:

select-string "Call Info-.*66000" *1006*.log -Context 2,2 | set-content ..\test.txt
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文