debtags search 'works-with-format::man' | awk 'BEGIN { FS="[: ]" } ! ($1 in seen) { print; seen[$1]=1 }'
Isso memorizará os pacotes vistos (no índice% array seen
), independentemente da arquitetura (portanto, usando tanto espaço quanto :
como separador) e não os imprimirá novamente se já tiver sido visto. Assim, ele também exibirá um pacote que existiria apenas em i386 e não na arquitetura padrão (amd64) (por exemplo: zsnes:i386
marcado com hardware::emulation
não existe como zsnes
(ou seja, zsnes:amd64
)). Como os pacotes sem arquitetura explícita mostrados vêm em primeiro lugar (nos algoritmos de pré-seleção de dívida ...), não é necessário se preocupar em exibir :i386
extra, a menos que seja necessário.
UPDATE: como desejado, o mesmo script awk em um arquivo de script independente colocado como / usr / local / bin / debtagsfilter com este conteúdo
#!/usr/bin/awk -f
BEGIN {
FS="[: ]"
}
! ($1 in seen) {
print
seen[$1]=1
}
e executável com ( chmod a+rx /usr/local/bin/filterdebtags
) pode ser usado por exemplo com: debtags search 'works-with-format::man' | filterdebtags
Ou, se uma "nova" versão de debtags chamada /usr/local/bin/debtagswithfilter
for preferida (voltando assim para sh
como linguagem de script chamada):
#!/bin/sh
debtags "$@" | awk '
BEGIN {
FS="[: ]"
}
! ($1 in seen) {
print
seen[$1]=1
}
'
compare (recebo duplicatas simples, talvez por causa de várias fontes de repositório):
$ debtags search 'hardware::emulation'
[...]
xtrs - emulator for TRS-80 Model I/III/4/4P computers
xtrs:i386 - emulator for TRS-80 Model I/III/4/4P computers
yabause - beautiful and under-rated Saturn emulator
yabause - beautiful and under-rated Saturn emulator
yabause-gtk - beautiful and under-rated Saturn emulator - Gtk port
yabause-gtk - beautiful and under-rated Saturn emulator - Gtk port
yabause-gtk:i386 - beautiful and under-rated Saturn emulator - Gtk port
yabause-gtk:i386 - beautiful and under-rated Saturn emulator - Gtk port
yabause-qt - beautiful and under-rated Saturn emulator - Qt port
yabause-qt - beautiful and under-rated Saturn emulator - Qt port
yabause-qt:i386 - beautiful and under-rated Saturn emulator - Qt port
yabause-qt:i386 - beautiful and under-rated Saturn emulator - Qt port
zsnes:i386 - Emulator of the Super Nintendo Entertainment System
com:
$ debtagswithfilter search 'hardware::emulation'
[...]
xtrs - emulator for TRS-80 Model I/III/4/4P computers
yabause - beautiful and under-rated Saturn emulator
yabause-gtk - beautiful and under-rated Saturn emulator - Gtk port
yabause-qt - beautiful and under-rated Saturn emulator - Qt port
zsnes:i386 - Emulator of the Super Nintendo Entertainment System
Funciona bem com solicitações de pesquisa mais complexas também:
$ debtagswithfilter search 'works-with-format::tex && interface::text-mode'
asymptote - script-based vector graphics language inspired by MetaPost
auctex - integrated document editing environment for TeX etc.
axiom-tex - General purpose computer algebra system: style file for TeX
bibcursed - Interactive program to edit BibTeX bibliographies
chktex - Finds typographic errors in LaTeX
fweb - literate-programming tool for C/C++/Fortran/Ratfor
groff - GNU troff text-formatting system
vim-latexsuite - view, edit and compile LaTeX documents from within Vim
yatex - Yet Another TeX mode for Emacs