如何将ack的输出保存到文件中?

How to save the output of ack to a file?

我正在尝试使用以下命令将 ack-grep 的输出重定向到一个文件:

ack-grep "some_regex" > file

此命令导致无限循环(我猜),并且 file 不断增长,直到系统用完磁盘 space。

这是 ack-grep --version 的输出:

ack-grep 2.12                              
Running under Perl 5.18.2 at /usr/bin/perl 

是否有使用重定向的替代方法?

只需将输出保存在别处ack-grep "some_regex" > ../file