Ack: Search Output Cheat Sheet

--lines=NUMOnly print NUM lines of each file
-l, --files-with-matchesOnly print filenames containing matches
-L, --files-without-matchesOnly print filenames with no matches
--output=exprOutput the evaluation of expression for each lineTurns off text highlighting.
-oShow only the part of a line matching pattern
--passthruPrint all lines, whether matching or not
--match PATTERNSpecify pattern explicitly.
-m, --max-count=NUMStop searching in each file after NUM matches
-1Stop searching after one match of any kind
-H, --with-filenamePrint the filename for each matchThis is the default unless explicitly searching a single file.
-h, --no-filenameSuppress the prefixing filename on output
-c, --countShow number of lines matching per file
--[no]columnShow the column number of the first match
-A NUM, --after-context=NUMPrint NUM lines of trailing context after matching lines
-B NUM, --before-context=NUMPrint NUM lines of leading context before matching lines
-C [NUM], --context[=NUM]Print NUM lines of output contextThe default is 2.
--print0Print null byte as separator between filenamesOnly works with -f, -g, -l, -L or -c.
-sSuppress error messages about nonexistent or unreadable files

Leave a Reply

Your email address will not be published. Required fields are marked *