【问题标题】:UNIX: redirect some commands with pipeUNIX:使用管道重定向一些命令
【发布时间】:2015-07-14 15:30:27
【问题描述】:

我是 Unix 新手。以下是我正在执行的命令。

$ time ls | wget exampledomain.com > output.txt

我希望命令将检索信息所花费的时间输出到 output.txt。这个命令我创建了 output.txt,但它只是一个空白文档。

谢谢

【问题讨论】:

  • 管道lswget 有什么意义?
  • 好点Arkadiusz。从长远来看,我只想提取检索信息并将其输出到文本文件所花费的时间。我认为 time ls 会更容易,因为它包含的无关信息更少。

标签: shell unix command


【解决方案1】:

wget 输出到标准错误。使用:

wget exampledomain.com > out 2>&1
# or
wget exampledomain.com 2>out
# or 
wget exampledomain.com --output-file=log
# or, to redirect the output both to file and stdout
wget exampledomain.com 2>&1 | tee log

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-01-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多