Hi,
I want to easily read apt-cache search output.
So I apply regular expression inside a function for apt-cache search inside .bashrc.
Code:
searchgrep() {
sudo apt-cache search $1 | grep -E '.*?\ -\ '
}
alias search=searchgrep
If you type
then you get this
Sample Output:
erlang-percept - Erlang/OTP concurrency profiling tool
golang - Go programming language compiler - metapackage
golang-1.6 - Go programming language compiler - metapackage
golang-1.6-doc - Go programming language - documentation
golang-1.6-go - Go programming language compiler, linker, compiled stdlib
However all I want is that grep only marks the first part, software name part.
How should I edit the regular expression to look the example below?
This is what I want to achieve:
erlang-percept - Erlang/OTP concurrency profiling tool
golang - Go programming language compiler - metapackage
golang-1.6 - Go programming language compiler - metapackage
golang-1.6-doc - Go programming language - documentation
golang-1.6-go - Go programming language compiler, linker, compiled stdlib
This is not a big problem but I am curious.
Thanks for your time.