I'm using ack to search for a string. When I run it without a file argument, I get line numbers:$> ack functionthemes/README.txt7:Drupal's sub-theme functionality to ensure easy maintenance and upgrades.sites/default/default.services.yml48:    # - The dump() function can be used in Twig templates to output information...But when I try to specify a file, I don't get line numbers. $> ack function themes/README.txtDrupal's sub-theme functionality to ensure easy maintenance and upgrades.I've done some googling for a switch, but found no results. How do I get ack to show me line numbers on results from a single file?
`ack` doesn't show line numbers on a single file
ack
When you don't provide any file, ack will search for all files in current directory and subdirectories. If a file contains matching pattern, ack print that filename, the line number and the line which matched pattern. This behaviour does not apply for one file (See ack documentation, search for -H option).Since when ack doesn't have -n option line grep, which will print line matched with its relative line number, you have two choices to work around this issue.Forcing ack print filename with -H:ack -H pattern fileor passing /dev/null as the second file:ack pattern file /dev/null