Artificial intelligent assistant

How does this text reformatting happen with ack? If I do a plain `ack` for a string, I get a line with the filename, and then the line numbers and the matching lines, like so: $> ack function mymodule.file 8: function myfunction1() { 16: public function __construct( $protocol = 'ftp') { 36: public static function getSupportedProtocols() { However, when I `ack` the results for a second string, the lines come out with more information on a single line: $> ack function|ack test mymodule.file:897:function mytest() { I noticed this also happens when grepping the results of `ack`. How is the information on various lines being reduced to one line? Is it the shell doing this?

This is done by `ack` itself. `ack` checks if its standard output is connected to a terminal, and if it isn't, it prints output in a different format. I guess this format was chosen because it is more easy to process by applications designed for text processing (like `grep` or `ack` itself).

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy b45230ef523b31c008f7ed9f7170c101