标签: pipe

如何用管道输出avconv

我正在尝试将 avconv 的输出通过管道传输到 grep,但不知何故管道无法正常工作。以下方法不起作用:

avconv -i MOVIE.mkv | grep SOMETHING - 应该只显示 avconv 中包含某些内容的行。

avconv -i MOVIE.mkv pipe: | grep SOMETHING - 应该只显示 avconv 中包含某些内容的行。

avconv -i MOVIE.mkv pipe:1 | grep SOMETHING - 应该只显示 avconv 中包含某些内容的行。

如何将信息从 avconv 输出到管道?

为什么它不起作用?

管道这样的东西,但不是-i信息参数:avconv -codecs | grep "264"

在 12.04 和 12.10 上测试

pipe avconv

3
推荐指数
1
解决办法
6314
查看次数

当管道输出到文件时,为什么 stderr 和 stdout 的顺序错误?

我有一个 perl 脚本:

warn "1\n";
print "2\n";
warn "3\n";
print "4\n";
Run Code Online (Sandbox Code Playgroud)

我将输出通过管道传输到文件:

perl script.pl &> foo
Run Code Online (Sandbox Code Playgroud)

猫福:

1
3
2
4
Run Code Online (Sandbox Code Playgroud)

为什么输出不按顺序,我该如何解决?

bash perl pipe stdout

3
推荐指数
1
解决办法
1181
查看次数

如何在命令行上捕获所有访问过的 URL?

我喜欢在命令行中实时捕获我在浏览器中访问的所有 URL,以便将它们传送到另一个程序。我怎么能做到这一点?

格式应该是每行一个 URL,没有别的,没有制表符,没有空格等。

这是我到目前为止所得到的。标签移除不起作用。我看到一条评论回复了一个人(在最底部),他在将它管道到 grep 时没有问题,他应该逃避它。我真的不明白这一点。

sudo httpry -F -i eth0 -f host,request-uri | tr -d 't'
Run Code Online (Sandbox Code Playgroud)

此外,即使这有效,它也不适用于 https 对吗?有没有另一种方法可以做到这一点,包括 https?如果存在,我愿意为 Firefox 和 Chromium 使用浏览器插件。只想将所有访问过的 URL 发送到脚本。

也许我可以实时解析浏览器的历史记录并进行管道传输?

command-line firefox bash chromium pipe

3
推荐指数
1
解决办法
5558
查看次数

下载 sql 并将其通过管道传输到 psql

我怎样才能一步完成此操作?

下载备份命令:

curl http://s3.aws.com/backup.sql
Run Code Online (Sandbox Code Playgroud)

恢复备份命令:

sudo -u postgres psql <PIPE-THE-OUTPUT-OF-PREVIOUS-COMMAND>
Run Code Online (Sandbox Code Playgroud)

bash postgresql pipe curl

3
推荐指数
1
解决办法
9836
查看次数

为什么 nginx 的重定向输出不起作用?

我想按行列出nginx服务器的所有模块,因此我输入以下内容:

nginx -V | tr -- - '\n'
Run Code Online (Sandbox Code Playgroud)

但它不会将模块排成一行。如果我这样做:

2>&1 nginx -V | tr -- - '\n'
Run Code Online (Sandbox Code Playgroud)

有用。但为什么?

output pipe

2
推荐指数
1
解决办法
1050
查看次数

find command is not able to find piped file

I have a file named .sock in /var/spool/ dir.

Here is the result of ls -al /var/spool/

drwxr-xr-x.  9 root     root 121 Dec 16 09:55 .
drwxr-xr-x. 19 root     root 267 Dec 14 10:47 ..
drwxr-xr-x.  2 root     root  63 Oct 28  2019 anacron
drwx------.  2 root     root   6 Feb 13  2019 cron
drwxr-xr-x.  2 root     root   6 Dec 14  2017 lpd
drwxrwxr-x.  2 root     mail  22 Dec 14 10:47 mail
prw-r--r--.  1 telegraf root   0 Dec 17 10:04 nethermind.sock …
Run Code Online (Sandbox Code Playgroud)

delete find pipe syslinux

2
推荐指数
1
解决办法
76
查看次数

为什么使用管道而不是输入重定向

我是 Linux 系统的新手,我无法真正理解为什么我们需要两个可以重定向输出的运算符:管道 as|和输出重定向运算符>?我们不能总是使用第二个吗?大多数时候,我发现如果多个命令链接在一起,就会使用管道。但是,如果输出重定向到文件(如 中),echo 'hello' > filename则使用输出重定向运算符。我在这里缺少什么?

output pipe redirect

1
推荐指数
1
解决办法
2627
查看次数

无法使用反斜杠转义点,为什么?

因此,以下是我运行的命令:

$ ~/Documents: touch ball.txt bool-txt bowl.txt bull.txt
$ ~/Documents: ls . | grep b..l\.txt
ball.txt
bool-txt
bowl.txt
bull.txt
Run Code Online (Sandbox Code Playgroud)

我没想到bool-txt会出现在输出中,因为我已经避开了点,但它仍然没有将其视为字面意义的点。我哪里错了?

grep pipe

1
推荐指数
1
解决办法
50
查看次数

如何搜索手册页?

我经常想搜索一个man页面,但是我不得不这样做:

man <package> | grep <search>
Run Code Online (Sandbox Code Playgroud)

或者:

man <package> > file.txt
Run Code Online (Sandbox Code Playgroud)

但是必须有比这更简单的方法来做到这一点,那么我如何man在其中搜索页面而不必将其内容发送到文件,或使用grep将必要的匹配内容打印到标准输出?

command-line grep pipe manpage

0
推荐指数
1
解决办法
729
查看次数

为什么管道不能与 'find' 和 'ls' 一起使用

为什么管道不能与 'find' 和 'ls' 一起使用如果我这样做了find . -name *foo* | ls -lah,它会执行 ls$PWD而不是 find 的输出。

然而,解决方案是find . -name *foo* | xargs -r ls -alh或可以使用 exec。

bash ls pipe xargs

0
推荐指数
1
解决办法
2989
查看次数

命令分组和流水线有什么区别?

我无法理解命令分组和流水线之间的区别

pipe

0
推荐指数
1
解决办法
131
查看次数

标签 统计

pipe ×11

bash ×4

command-line ×2

grep ×2

output ×2

avconv ×1

chromium ×1

curl ×1

delete ×1

find ×1

firefox ×1

ls ×1

manpage ×1

perl ×1

postgresql ×1

redirect ×1

stdout ×1

syslinux ×1

xargs ×1