Ubuntu – How to use apt-get to install packages without one specify package

apt

For example:

The following command will install all packages that match it's pattern:

  sudo apt-get install k3b-*

If I want to use that instruction but don't want to install one specific package with broken dependencies, how do I do that?

I have tried this but not works.

sudo apt-get install "$(apt-cache –no-generate pkgnames k3b | grep -v extrathemes | tr '\n' ' ')" :

 sam@/home/sam/code/ros/ai/cram/roslisp_repl$ sudo apt-get install      "$(apt-cache --no-generate pkgnames k3b | grep -v extrathemes | tr '\n' ' ')"
 Reading package lists... Done
 Building dependency tree       
 Reading state information... Done
 E: Unable to locate package k3b-dbg k3b-data k3b 

 sam@/home/sam/code/ros/ai/cram/roslisp_repl$

Thank you~

Best Answer

You can do

list=$(apt-cache --names-only search ^k3b-* | awk '{ print $1 }' | \
    grep -v bad-pkg)
sudo apt-get install $list