Попробуйте:
sed -e "s/[[:space:]]\+/\t/g" filename | cut -f2
Первая команда (sed) заменит все символы пробела на одну вкладку, и результат будет передан второй команде (cut), которая выберет второе поле из каждой строки.
Для получения дополнительной информации см. man cut и man sed.
Используйте dpkg -s, чтобы узнать, какая версия пакета установлена.
sudo dpkg -s coreutils
Это должно дать вам что-то вроде этого:
Package: coreutils
Essential: yes
Status: install ok installed
Priority: required
Section: utils
Installed-Size: 6020
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Architecture: amd64
Multi-Arch: foreign
Version: 8.21-1ubuntu5.1
...
Как вы можете видеть, У меня установлена версия 8.21-1ubuntu5.1.
Мои пятьдесят центов:)
С dpkg-query% dpkg-query --show coreutils
coreutils 8.23-4ubuntu2
С axi-cache % axi-cache policy coreutils
coreutils:
Installed: 8.23-4ubuntu2
Candidate: 8.23-4ubuntu2
Version table:
*** 8.23-4ubuntu2 0
500 http://archive.ubuntu.com/ubuntu/ wily/main amd64 Packages
100 /var/lib/dpkg/status
Последняя версия coreutils - это 8.24, смотрящее на зеркало GNU.
В репозиториях Ubuntu последняя версия - зеркало GNU :
Package coreutils
precise (12.04LTS) (utils): GNU core utilities
8.13-3ubuntu3.3 [security]: amd64 i386
precise-updates (utils): GNU core utilities
8.13-3ubuntu3.3: amd64 i386
trusty (14.04LTS) (utils): GNU core utilities
8.21-1ubuntu5.1 [security]: amd64 i386
trusty-updates (utils): GNU core utilities
8.21-1ubuntu5.1: amd64 i386
vivid (utils): GNU core utilities
8.23-3ubuntu1: amd64 i386
wily (utils): GNU core utilities
8.23-4ubuntu2: amd64 i386
xenial (utils): GNU core utilities
8.23-4ubuntu2: amd64 i386
Вы можете сделать dpkg -s <packagename>
Вывод этой команды будет для coreutils:
Section: utils
Installed-Size: 12955
Maintainer: Michael Stone <mstone@debian.org>
Architecture: armhf
Multi-Arch: foreign
Version: 8.23-4
Replaces: mktemp, realpath, timeout
Pre-Depends: libacl1 (>= 2.2.51-8), libattr1 (>= 1:2.4.46-8), libc6 (>= 2.17), libselinux1 (>= 2.1.13)
Conflicts: timeout
Description: GNU core utilities
This package contains the basic file, shell and text manipulation
utilities which are expected to exist on every operating system.
Specifically, this package includes:
arch base64 basename cat chcon chgrp chmod chown chroot cksum comm cp
csplit cut date dd df dir dircolors dirname du echo env expand expr
factor false flock fmt fold groups head hostid id install join link ln
logname ls md5sum mkdir mkfifo mknod mktemp mv nice nl nohup nproc numfmt
od paste pathchk pinky pr printenv printf ptx pwd readlink realpath rm
rmdir runcon sha*sum seq shred sleep sort split stat stty sum sync tac
tail tee test timeout touch tr true truncate tsort tty uname unexpand
uniq unlink users vdir wc who whoami yes
Homepage: http://gnu.org/software/coreutils