OS:CentOS7
補足:多量のテキストの中から、条件に合う列のみを抽出
[root@cent01 ~]# cat /var/log/messages ←多量のログが出力される
Mar 18 23:04:46 cent01 kernel: Initializing cgroup subsys cpuset
Mar 18 23:04:46 cent01 kernel: Initializing cgroup subsys cpu
Mar 18 23:04:46 cent01 kernel: Initializing cgroup subsys cpuacct
Mar 18 23:04:46 cent01 kernel: Linux version 3.10.0-693.el7.x86_64 (builder@kbuilder.dev.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-16) (GCC) ) #1 SMP Tue Aug 22 21:09:27 UTC 2017
Mar 18 23:04:46 cent01 kernel: Command line: BOOT_IMAGE=/vmlinuz-3.10.0-693.el7.x86_64 root=/dev/mapper/centos-root ro crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet LANG=ja_JP.UTF-8
Mar 18 23:04:46 cent01 kernel: e820: BIOS-provided physical RAM map:
Mar 18 23:04:46 cent01 kernel: BIOS-e820: [mem 0x0000000000000000-0x000000000009fbff] usable
Mar 18 23:04:46 cent01 kernel: BIOS-e820: [mem 0x000000000009fc00-0x000000000009ffff] reserved
Mar 18 23:04:46 cent01 kernel: BIOS-e820: [mem 0x00000000000f0000-0x00000000000fffff] reserved
Mar 18 23:04:46 cent01 kernel: BIOS-e820: [mem 0x0000000000100000-0x00000000dffeffff] usable
Mar 18 23:04:46 cent01 kernel: BIOS-e820: [mem 0x00000000dfff0000-0x00000000dfffffff] ACPI data
Mar 18 23:04:46 cent01 kernel: BIOS-e820: [mem 0x00000000fec00000-0x00000000fec00fff] reserved
~~省略~~
Mar 19 00:04:49 cent01 systemd: Starting Cleanup of Temporary Directories...
Mar 19 00:04:49 cent01 systemd: Started Cleanup of Temporary Directories.
Mar 19 00:07:35 cent01 systemd: Reloading.
Mar 19 00:07:35 cent01 yum[1294]: Installed: ntpdate-4.2.6p5-25.el7.centos.2.x86_64
[root@cent01 ~]#
[root@cent01 ~]#
[root@cent01 ~]# cat /var/log/messages | grep stop ←ログから「stop」を含む列のみを抽出
Mar 18 23:04:49 cent01 journal: Journal stopped
Mar 18 23:49:17 cent01 journal: Journal stopped
[root@cent01 ~]#
[root@cent01 ~]#
[root@cent01 ~]# cat /var/log/messages | grep journal ←次に「journal」を含む列のみを抽出
Mar 18 23:04:46 cent01 journal: Journal started
Mar 18 23:04:49 cent01 journal: Journal stopped
Mar 18 23:04:50 cent01 Journal: Runtime Journal is using 8.0M (max allowed 184.7M, trying to leave 277.1M free of 1.7G available → current limit 184.7M).
Mar 18 23:04:50 cent01 Journal: Runtime Journal is using 8.0M (max allowed 184.7M, trying to leave 277.1M free of 1.7G available → current limit 184.7M).
Mar 18 23:04:50 cent01 systemd-Journald[96]: Received SIGTERM from PID 1 (systemd).
Mar 18 23:04:50 cent01 Journal: Journal started
Mar 18 23:04:50 cent01 Journal: Runtime Journal is using 8.0M (max allowed 184.7M, trying to leave 277.1M free of 1.7G available → current limit 184.7M).
[root@cent01 ~]#