7

Currently I'm using ack-grep 1.92. Now I want to use ack-grep 2.+.

Official documentation says that I can install ack-grep 2.0 with apt-get, but when I try to install, it says it's already the newest version.

I also tried install it with a specified version like:

sudo apt-get install ack-grep 2.10

It installs something, but ack-grep is still 1.92.

How can I install the newest version?

3
  • Your frustration about packages being slightly out of day is common. I apologize if beyondgrep.com/install makes it sound like it's saying anything about what version is available in any given package manager. Above the package list, that page says "Please note that the maintainers of ack have nothing to do with these packages. If a given package is out of date or doesn't work, you'll need to work with the packagers, not the ack team." Is there something I could do on the page that would make it clearer that packaging is out of my hands? Oct 9, 2013 at 13:49
  • @AndyLester Thanks for a kind reply. My misunderstanding is caused by my lack of knowledge of Ubuntu packages and my careless reading. I think it would be good to put some links about "how to install" like this page.:) Oct 9, 2013 at 16:20
  • 1
    Important to read askubuntu.com/questions/151283/…
    – Braiam
    Oct 15, 2013 at 14:24

4 Answers 4

4

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:

It's a deb file, so you can be interested also by:

2
  • 2
    You can install current version of ack by executing: curl http://beyondgrep.com/ack-2.12-single-file > /usr/bin/ack && chmod 0755 !#:3
    – jmarceli
    Feb 19, 2014 at 11:32
  • 3
    For future readers: Note that that URL in the command is out of date. The best way to do the single file install is by going to beyondgrep.com/install Oct 6, 2014 at 12:30
3

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

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
2

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.