debtags search 'works-with-format::man' | awk 'BEGIN { FS="[: ]" } ! ($1 in seen) { print; seen[$1]=1 }'
Это запомнит увиденные пакеты (в seen
индексе массива ), независимо от архитектуры (, следовательно, используя как пробел, так и :
в качестве разделителя ), и не будет печатать их снова, если они уже были замечены. Таким образом, он также будет отображать пакет, который существовал бы только в i386, а не в стандартной архитектуре (amd64 )(, например,:zsnes:i386
с тегом hardware::emulation
не существует, поскольку zsnes
(, т.е. zsnes:amd64
)). Поскольку пакеты без показанной явной архитектуры стоят первыми (в алгоритмах предварительной сортировки отложенных тегов... ), нет необходимости беспокоиться об отображении дополнительных :i386
, если они не нужны.
ОБНОВЛЕНИЕ :по желанию тот же сценарий awk в отдельном файле сценария, помещенном как /usr/local/bin/debtagsfilter с этим содержимым
#!/usr/bin/awk -f
BEGIN {
FS="[: ]"
}
! ($1 in seen) {
print
seen[$1]=1
}
и сделанный исполняемым с помощью(chmod a+rx /usr/local/bin/filterdebtags
)можно использовать, например, с:debtags search 'works-with-format::man' | filterdebtags
Или,если предпочтительна «новая» версия долговых тегов с именем /usr/local/bin/debtagswithfilter
(, таким образом, возвращается к sh
в качестве вызываемого языка сценариев):
#!/bin/sh
debtags "$@" | awk '
BEGIN {
FS="[: ]"
}
! ($1 in seen) {
print
seen[$1]=1
}
'
сравните (Я получаю простые дубли, возможно, из-за нескольких источников репозитория):
$ 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
с:
$ 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
Он отлично работает и с более сложными поисковыми запросами:
$ 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
Установите/настройте репозиторий EPEL (, см.:Fedora Wiki)и установите черезyum check-update ; yum install xclip