If you are using Ubuntu 13.10, then you can install ack-grep 2.04.2 using the Ubuntu Software Center. The ack-grep package is from the universe repository. ack-grep is a meta package to pull ack in 18.04 and later. Run sudo apt install ack
and execute ack instead of ack-grep.
To give an example of what ack-grep can do, here is a command to display eight lines from somewhere in the middle of the bash manual, which is larger than 300Kb, and therefore it is inconvenient to find a referenced line number in the bash manual by scrolling down in the terminal, but it's easy to do with ack-grep:
man bash | ack-grep . --lines=4581-4588
...gives the following block of text from the bash manual as output:
pwd [-LP]
Print the absolute pathname of the current working directory.
The pathname printed contains no symbolic links if the -P option
is supplied or the -o physical option to the set builtin command
is enabled. If the -L option is used, the pathname printed may
contain symbolic links. The return status is 0 unless an error
occurs while reading the name of the current directory or an
invalid option is supplied.
The command that is equivalent to the above command in 18.04 and later uses ack
instead of ack-grep
and different line numbers because the bash manual is longer in 18.04. ack
works the same as ack-grep
and outputs the same results:
man bash | ack . --lines=4970-4977