Самым простым решением было бы просто добавить еще одну getline
и тогда получить 5 строк вместо 6:
$ awk '/z ~/ {getline;for(i=1; i<=5; i++) {getline; print $4, $5, $6}}' file
0.00781 0.00108 0.00038
0.01271 -0.01507 0.02839
-0.05015 -0.01803 0.01588
0.01733 0.03089 -0.04611
0.01230 0.00114 0.00147
Лично я бы сделал это немного по-другому:
$ awk '/z ~/{f=2;} /~ ~/{f--}; (f==1 && NF>5){print $4, $5, $6} ' file
0.00781 0.00108 0.00038
0.01271 -0.01507 0.02839
-0.05015 -0.01803 0.01588
0.01733 0.03089 -0.04611
0.01230 0.00114 0.00147
Идея состоит в том, чтобы установить флаг (переменной f
)на 2
в строке, соответствующей z ~
, и уменьшать ее значение на единицу каждый раз, когда мы находим строку, соответствующую ~ ~
. Затем мы печатаем поля 4, 5 и 6 только в строках, где f
— это1
и , которые имеют не менее 5 полей.
Для обоих примеров, чтобы получить красивую печать, вы можете использовать -vOFS="\t"
или даже лучшеprintf
:
$ awk '/z ~/{f=2;} /~ ~/{f--}; (f==1 && NF>5){printf "%10s%10s%10s\n", $4, $5, $6} ' file
0.00781 0.00108 0.00038
0.01271 -0.01507 0.02839
-0.05015 -0.01803 0.01588
0.01733 0.03089 -0.04611
0.01230 0.00114 0.00147
Согласно rpm.org , зависимости определены в файле .spec
,
With this tag a package can require another with the matching name or Provides to be installed (if the package containign the Requires: is going to be installed). This is checked when a new package is installed and if a package with a matching Provides: is removed.
И пример, который они дают,
Requires: python perl
Самый простой известный мне подход — использовать требования к сборке, которые, по мнению сопровождающих пакетов, являются актуальными, в совместимом дистрибутиве. Поскольку Python 3 недоступен в CentOS, вам придется посмотреть на EPEL или какой-либо другой репозиторий; Fedora размещает соответствующий исходный пакет .
Список зависимостей сборки для дистрибутива на основе RPM -см. в файле .spec
пакета:зависимости сборки перечислены в BuildRequires
. Для Python 3:
BuildRequires: autoconf
BuildRequires: bluez-libs-devel
BuildRequires: bzip2
BuildRequires: bzip2-devel
BuildRequires: desktop-file-utils
BuildRequires: expat-devel
BuildRequires: findutils
BuildRequires: gcc-c++
%if %{with gdbm}
BuildRequires: gdbm-devel
%endif
BuildRequires: glibc-all-langpacks
BuildRequires: glibc-devel
BuildRequires: gmp-devel
BuildRequires: libappstream-glib
BuildRequires: libffi-devel
BuildRequires: libnsl2-devel
BuildRequires: libtirpc-devel
BuildRequires: libGL-devel
BuildRequires: libuuid-devel
BuildRequires: libX11-devel
BuildRequires: ncurses-devel
BuildRequires: openssl-devel
BuildRequires: pkgconfig
BuildRequires: readline-devel
BuildRequires: redhat-rpm-config >= 127
BuildRequires: sqlite-devel
BuildRequires: gdb
BuildRequires: tar
BuildRequires: tcl-devel
BuildRequires: tix-devel
BuildRequires: tk-devel
%if %{with valgrind}
BuildRequires: valgrind-devel
%endif
BuildRequires: xz-devel
BuildRequires: zlib-devel
BuildRequires: /usr/bin/dtrace
# workaround http://bugs.python.org/issue19804 (test_uuid requires ifconfig)
BuildRequires: /usr/sbin/ifconfig
%if %{with rpmwheels}
BuildRequires: python-setuptools-wheel
BuildRequires: python-pip-wheel
%endif