How to install ack-grep 2.0 with apt-get?
Solution 1:
You can't install yet ack-grep 2.10 using apt-get because ack-grep 2.10 is not yet included in Ubuntu repositories. To see what versions are available in repositories, you can use the following command:
apt-cache showpkg ack-grep
But you can install by downloading it from here:
- http://packages.debian.org/sid/ack-grep
It's a deb file, so you can be interested also by:
- How do I install a .deb file via the command line?
Solution 2:
You don't have to wait for saucy (Ubuntu 13.10) to be released to use its version of ack-grep. You can install just one package, and its unmet dependencies, from a future release with the right apt-pinning preferences.
See these examples:
Install packages from newer release without building (apt pinning)
Install a single specific package from future distribution
Solution 3:
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
Solution 4:
An ack2 PPA for Precise 12.04 has been created by Leonard Ehrenfried here:
http://leonard.io/blog/2013/10/ack2-package-for-ubuntu-1204-precise/
https://launchpad.net/~leonard-ehrenfried/+archive/ack2
For those like me on Quantal 12.10, the PPA can still be used once added by replacing "quantal
" with "precise
" in /etc/apt/sources.list.d/leonard-ehrenfried-ack2-quantal.list