Эти вещи часто проще, используя арифметику по модулю, например.
awk '(NR-2)%5 && (NR-1)%5' file
3
4
5
3
4
5
3
4
5
В качестве альтернативы, используя нотацию GNU sedn~m
("n skip m" ):
sed '1~5d;2~5d' file
Я начну с цитирования раздела ПРИМЕРЫ в man xdg-mime
EXAMPLES
xdg-mime install shinythings-shiny.xml
Adds a file type description for "shiny"-files. "shinythings-" is used as the vendor prefix. The file type description could look as follows.
shinythings-shiny.xml:
<?xml version="1.0"?>
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
<mime-type type="text/x-shiny">
<comment>Shiny new file type</comment>
<glob pattern="*.shiny"/>
<glob pattern="*.shi"/>
</mime-type>
</mime-info>
An icon for this new file type must also be installed, for example with:
xdg-icon-resource install --context mimetypes --size 64 shiny-file-icon.png text-x-shiny
I wish to understand both adding this mime association for 1) my user account as well as 2) system-wide.
С той же man
страницы
xdg-mime install [--mode mode] [--novendor] mimetypes-file
--mode mode
mode can be user or system. In user mode the file is (un)installed for the current user only. In system mode the file is (un)installed for all users on the system. Usually only root is allowed to install in system mode.
The default is to use system mode when called by root and to use user mode when called by a non-root user.
when including glob-deleteall in a user-local definition, it removes any existing system-wide mime associations
Да , glob -deleteall используется для перезаписи части glob определения MIME-типа, но не только системы -во всей системе. Оба в зависимости от режима
mentions the specific directories where things should be located on an Arch Linux system
системный режим будет установлен в /usr/share/mime/
. режим пользователя от до .local/share/mime
и список файлов:
./.local/share/mime/generic-icons
./.local/share/mime/mime.cache
./.local/share/mime/types
./.local/share/mime/text
./.local/share/mime/text/x-shiny.xml
./.local/share/mime/version
./.local/share/mime/treemagic
./.local/share/mime/globs
./.local/share/mime/globs2
./.local/share/mime/aliases
./.local/share/mime/subclasses
./.local/share/mime/magic
./.local/share/mime/icons
./.local/share/mime/XMLnamespaces
./.local/share/mime/packages/shinythings-shiny.xml
Ведь беги
update-mime-database ~/.local/share/mime/
, чтобы активировать конфигурацию.