[Bash-completion-commits] [bash-completion] 01/01: aptitude, dpkg: Replace some grep+cuts with awk

Ville Skyttä scop-guest at moszumanska.debian.org
Mon Jan 6 15:57:19 UTC 2014


This is an automated email from the git hooks/post-receive script.

scop-guest pushed a commit to branch master
in repository bash-completion.

commit e777395ac3ce25527e58e04bfc406ae03bdb3b12
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Mon Jan 6 17:56:36 2014 +0200

    aptitude, dpkg: Replace some grep+cuts with awk
---
 completions/aptitude | 2 +-
 completions/dpkg     | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/completions/aptitude b/completions/aptitude
index fb407d2..61e2d3b 100644
--- a/completions/aptitude
+++ b/completions/aptitude
@@ -9,7 +9,7 @@ _comp_dpkg_hold_packages()
 _comp_dpkg_hold_packages()
 {
     command grep -B 2 'hold' /var/lib/dpkg/status | \
-        command grep "Package: $1" | cut -d\  -f2
+        awk "/Package: $1/ { print \$2 }"
 }
 }
 
diff --git a/completions/dpkg b/completions/dpkg
index 7ecad5f..be49503 100644
--- a/completions/dpkg
+++ b/completions/dpkg
@@ -12,7 +12,7 @@ _comp_dpkg_installed_packages()
         command grep -B 1 -Ee "ok installed|half-installed|unpacked| \
             half-configured" \
             -Ee "^Essential: yes" | \
-        command grep "Package: $1" 2>/dev/null | cut -d\  -f2
+        awk "/Package: $1/ { print \$2 }" 2>/dev/null
 }
 }
 
@@ -28,7 +28,7 @@ _comp_dpkg_purgeable_packages()
         command grep -B 1 -Ee "ok installed|half-installed|unpacked| \
             half-configured|config-files" \
             -Ee "^Essential: yes" | \
-        command grep "Package: $1" 2>/dev/null | cut -d\  -f2
+        awk "/Package: $1/ { print \$2 }" 2>/dev/null
 }
 }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/bash-completion/bash-completion.git



More information about the Bash-completion-commits mailing list