作者:邓聪聪

提取日志或文本中的关键内容

 Apr  :: localhost NetworkManager[]: <info>  (eno16777736): Activation: starting connection 'eno16777736' (ecefc7de-e893-4eee-88fd-bb9843616ec2)
Apr :: localhost NetworkManager[]: <info> (eno16777736): device state change: disconnected -> prepare (reason 'none') [ ]
Apr :: localhost NetworkManager[]: <info> NetworkManager state is now CONNECTING
Apr :: localhost NetworkManager[]: <info> (eno16777736): device state change: prepare -> config (reason 'none') [ ]
Apr :: localhost NetworkManager[]: <info> (eno16777736): device state change: config -> ip-config (reason 'none') [ ]
Apr :: localhost NetworkManager[]: <info> Activation (eno16777736) Beginning DHCPv4 transaction (timeout in seconds)
Apr :: localhost NetworkManager[]: <info> dhclient started with pid
Apr :: localhost dhclient[]: DHCPDISCOVER on eno16777736 to 255.255.255.255 port interval (xid=0x398e2136)
Apr :: localhost dhclient[]: DHCPREQUEST on eno16777736 to 255.255.255.255 port (xid=0x398e2136)
Apr :: localhost dhclient[]: DHCPOFFER from 10.0.0.254
Apr :: localhost dhclient[]: DHCPACK from 10.0.0.254 (xid=0x398e2136)
Apr :: localhost NetworkManager[]: <info> address 10.0.0.132
Apr :: localhost NetworkManager[]: <info> plen (255.255.255.0)
Apr :: localhost NetworkManager[]: <info> gateway 10.0.0.2
Apr :: localhost NetworkManager[]: <info> server identifier 10.0.0.254
Apr :: localhost NetworkManager[]: <info> lease time
Apr :: localhost NetworkManager[]: <info> nameserver '10.0.0.2'
Apr :: localhost NetworkManager[]: <info> domain name 'localdomain'
Apr :: localhost NetworkManager[]: <info> (eno16777736): DHCPv4 state changed unknown -> bound
Apr :: localhost NetworkManager[]: <info> (eno16777736): device state change: ip-config -> ip-check (reason 'none') [ ]
Apr :: localhost NetworkManager[]: <info> (eno16777736): device state change: ip-check -> secondaries (reason 'none') [ ]
Apr :: localhost NetworkManager[]: <info> (eno16777736): device state change: secondaries -> activated (reason 'none') [ ]
Apr :: localhost NetworkManager[]: <info> NetworkManager state is now CONNECTED_LOCAL
Apr :: localhost NetworkManager[]: <info> NetworkManager state is now CONNECTED_GLOBAL
Apr :: localhost NetworkManager[]: <info> Policy set 'eno16777736' (eno16777736) as default for IPv4 routing and DNS.
Apr :: localhost NetworkManager[]: <info> (eno16777736): Activation: successful, device activated.
Apr :: localhost nm-dispatcher: Dispatching action 'up' for eno16777736
Apr :: localhost network: Bringing up interface eno16777736: Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/)
Apr :: localhost dhclient[]: bound to 10.0.0.132 -- renewal in seconds.
Apr :: localhost network: [ OK ]
Apr :: localhost systemd: Started LSB: Bring up/down networking.
Apr :: localhost dbus[]: avc: received setenforce notice (enforcing=)
Apr :: localhost dbus-daemon: dbus[]: avc: received setenforce notice (enforcing=)
Apr :: localhost systemd: Stopping firewalld - dynamic firewall daemon...
Apr :: localhost kernel: Ebtables v2. unregistered
Apr :: localhost systemd: Stopped firewalld - dynamic firewall daemon.
Apr :: localhost systemd: Started Session of user root.
Apr :: localhost systemd-logind: New session of user root.
Apr :: localhost systemd: Starting Session of user root.
Apr :: localhost dhclient[]: DHCPREQUEST on eno16777736 to 10.0.0.254 port (xid=0x398e2136)
Apr :: localhost dhclient[]: DHCPACK from 10.0.0.254 (xid=0x398e2136)
Apr :: localhost NetworkManager[]: <info> address 10.0.0.132
Apr :: localhost NetworkManager[]: <info> plen (255.255.255.0)
Apr :: localhost NetworkManager[]: <info> gateway 10.0.0.2
Apr :: localhost NetworkManager[]: <info> server identifier 10.0.0.254
Apr :: localhost NetworkManager[]: <info> lease time
Apr :: localhost NetworkManager[]: <info> nameserver '10.0.0.2'
Apr :: localhost NetworkManager[]: <info> domain name 'localdomain'
Apr :: localhost NetworkManager[]: <info> (eno16777736): DHCPv4 state changed bound -> bound
Apr :: localhost dbus[]: [system] Activating via systemd: service name='org.freedesktop.nm_dispatcher' unit='dbus-org.freedesktop.nm-dispatcher.service'
Apr :: localhost systemd: Starting Network Manager Script Dispatcher Service...
Apr :: localhost dbus-daemon: dbus[]: [system] Activating via systemd: service name='org.freedesktop.nm_dispatcher' unit='dbus-org.freedesktop.nm-dispatcher.service'
Apr :: localhost dhclient[]: bound to 10.0.0.132 -- renewal in seconds.
Apr :: localhost dbus[]: [system] Successfully activated service 'org.freedesktop.nm_dispatcher'
Apr :: localhost dbus-daemon: dbus[]: [system] Successfully activated service 'org.freedesktop.nm_dispatcher'
Apr :: localhost systemd: Started Network Manager Script Dispatcher Service.
Apr :: localhost nm-dispatcher: Dispatching action 'dhcp4-change' for eno16777736
Apr :: localhost systemd: Starting Cleanup of Temporary Directories...
Apr :: localhost systemd: Started Cleanup of Temporary Directories.
Apr :: localhost dhclient[]: DHCPREQUEST on eno16777736 to 10.0.0.254 port (xid=0x398e2136)
Apr :: localhost dhclient[]: DHCPACK from 10.0.0.254 (xid=0x398e2136)
Apr :: localhost NetworkManager[]: <info> address 10.0.0.132
Apr :: localhost NetworkManager[]: <info> plen (255.255.255.0)
Apr :: localhost NetworkManager[]: <info> gateway 10.0.0.2
Apr :: localhost NetworkManager[]: <info> server identifier 10.0.0.254
Apr :: localhost NetworkManager[]: <info> lease time
Apr :: localhost NetworkManager[]: <info> nameserver '10.0.0.2'
Apr :: localhost NetworkManager[]: <info> domain name 'localdomain'
Apr :: localhost NetworkManager[]: <info> (eno16777736): DHCPv4 state changed bound -> bound
Apr :: localhost dbus[]: [system] Activating via systemd: service name='org.freedesktop.nm_dispatcher' unit='dbus-org.freedesktop.nm-dispatcher.service'
Apr :: localhost dbus-daemon: dbus[]: [system] Activating via systemd: service name='org.freedesktop.nm_dispatcher' unit='dbus-org.freedesktop.nm-dispatcher.service'
Apr :: localhost systemd: Starting Network Manager Script Dispatcher Service...
Apr :: localhost dhclient[]: bound to 10.0.0.132 -- renewal in seconds.
Apr :: localhost dbus[]: [system] Successfully activated service 'org.freedesktop.nm_dispatcher'
Apr :: localhost dbus-daemon: dbus[]: [system] Successfully activated service 'org.freedesktop.nm_dispatcher'
Apr :: localhost systemd: Started Network Manager Script Dispatcher Service.
Apr :: localhost nm-dispatcher: Dispatching action 'dhcp4-change' for eno16777736
Apr :: localhost systemd: Started Session of user root.
Apr :: localhost systemd: Starting Session of user root.
Apr :: localhost dhclient[]: DHCPREQUEST on eno16777736 to 10.0.0.254 port (xid=0x398e2136)
Apr :: localhost dhclient[]: DHCPACK from 10.0.0.254 (xid=0x398e2136)
Apr :: localhost NetworkManager[]: <info> address 10.0.0.132
Apr :: localhost NetworkManager[]: <info> plen (255.255.255.0)
Apr :: localhost NetworkManager[]: <info> gateway 10.0.0.2
Apr :: localhost NetworkManager[]: <info> server identifier 10.0.0.254
Apr :: localhost NetworkManager[]: <info> lease time
Apr :: localhost NetworkManager[]: <info> nameserver '10.0.0.2'
Apr :: localhost NetworkManager[]: <info> domain name 'localdomain'
Apr :: localhost NetworkManager[]: <info> (eno16777736): DHCPv4 state changed bound -> bound
Apr :: localhost dbus[]: [system] Activating via systemd: service name='org.freedesktop.nm_dispatcher' unit='dbus-org.freedesktop.nm-dispatcher.service'
Apr :: localhost systemd: Starting Network Manager Script Dispatcher Service...
Apr :: localhost dbus-daemon: dbus[]: [system] Activating via systemd: service name='org.freedesktop.nm_dispatcher' unit='dbus-org.freedesktop.nm-dispatcher.service'
Apr :: localhost dhclient[]: bound to 10.0.0.132 -- renewal in seconds.
Apr :: localhost dbus[]: [system] Successfully activated service 'org.freedesktop.nm_dispatcher'
Apr :: localhost dbus-daemon: dbus[]: [system] Successfully activated service 'org.freedesktop.nm_dispatcher'
Apr :: localhost systemd: Started Network Manager Script Dispatcher Service.
Apr :: localhost nm-dispatcher: Dispatching action 'dhcp4-change' for eno16777736
Apr :: localhost dhclient[]: DHCPREQUEST on eno16777736 to 10.0.0.254 port (xid=0x398e2136)
Apr :: localhost dhclient[]: DHCPACK from 10.0.0.254 (xid=0x398e2136)
Apr :: localhost NetworkManager[]: <info> address 10.0.0.132
Apr :: localhost NetworkManager[]: <info> plen (255.255.255.0)
Apr :: localhost NetworkManager[]: <info> gateway 10.0.0.2
Apr :: localhost NetworkManager[]: <info> server identifier 10.0.0.254
Apr :: localhost NetworkManager[]: <info> lease time
Apr :: localhost NetworkManager[]: <info> nameserver '10.0.0.2'
Apr :: localhost NetworkManager[]: <info> domain name 'localdomain'
Apr :: localhost NetworkManager[]: <info> (eno16777736): DHCPv4 state changed bound -> bound
Apr :: localhost dbus[]: [system] Activating via systemd: service name='org.freedesktop.nm_dispatcher' unit='dbus-org.freedesktop.nm-dispatcher.service'
Apr :: localhost systemd: Starting Network Manager Script Dispatcher Service...
Apr :: localhost dbus-daemon: dbus[]: [system] Activating via systemd: service name='org.freedesktop.nm_dispatcher' unit='dbus-org.freedesktop.nm-dispatcher.service'
Apr :: localhost dhclient[]: bound to 10.0.0.132 -- renewal in seconds.
Apr :: localhost dbus[]: [system] Successfully activated service 'org.freedesktop.nm_dispatcher'
Apr :: localhost dbus-daemon: dbus[]: [system] Successfully activated service 'org.freedesktop.nm_dispatcher'
Apr :: localhost systemd: Started Network Manager Script Dispatcher Service.
Apr :: localhost nm-dispatcher: Dispatching action 'dhcp4-change' for eno16777736
Apr :: localhost dhclient[]: DHCPREQUEST on eno16777736 to 10.0.0.254 port (xid=0x398e2136)
Apr :: localhost dhclient[]: DHCPACK from 10.0.0.254 (xid=0x398e2136)
Apr :: localhost NetworkManager[]: <info> address 10.0.0.132
Apr :: localhost NetworkManager[]: <info> plen (255.255.255.0)
Apr :: localhost NetworkManager[]: <info> gateway 10.0.0.2
Apr :: localhost NetworkManager[]: <info> server identifier 10.0.0.254
Apr :: localhost NetworkManager[]: <info> lease time
Apr :: localhost NetworkManager[]: <info> nameserver '10.0.0.2'
Apr :: localhost NetworkManager[]: <info> domain name 'localdomain'
Apr :: localhost NetworkManager[]: <info> (eno16777736): DHCPv4 state changed bound -> bound
Apr :: localhost dbus[]: [system] Activating via systemd: service name='org.freedesktop.nm_dispatcher' unit='dbus-org.freedesktop.nm-dispatcher.service'
Apr :: localhost systemd: Starting Network Manager Script Dispatcher Service...
Apr :: localhost dbus-daemon: dbus[]: [system] Activating via systemd: service name='org.freedesktop.nm_dispatcher' unit='dbus-org.freedesktop.nm-dispatcher.service'
Apr :: localhost dhclient[]: bound to 10.0.0.132 -- renewal in seconds.
Apr :: localhost dbus[]: [system] Successfully activated service 'org.freedesktop.nm_dispatcher'
Apr :: localhost dbus-daemon: dbus[]: [system] Successfully activated service 'org.freedesktop.nm_dispatcher'
Apr :: localhost systemd: Started Network Manager Script Dispatcher Service.
Apr :: localhost nm-dispatcher: Dispatching action 'dhcp4-change' for eno16777736
Apr :: localhost dhclient[]: DHCPREQUEST on eno16777736 to 10.0.0.254 port (xid=0x398e2136)
Apr :: localhost dhclient[]: DHCPACK from 10.0.0.254 (xid=0x398e2136)
Apr :: localhost NetworkManager[]: <info> address 10.0.0.132
Apr :: localhost NetworkManager[]: <info> plen (255.255.255.0)
Apr :: localhost NetworkManager[]: <info> gateway 10.0.0.2
Apr :: localhost NetworkManager[]: <info> server identifier 10.0.0.254
Apr :: localhost NetworkManager[]: <info> lease time
Apr :: localhost NetworkManager[]: <info> nameserver '10.0.0.2'
Apr :: localhost NetworkManager[]: <info> domain name 'localdomain'
Apr :: localhost NetworkManager[]: <info> (eno16777736): DHCPv4 state changed bound -> bound
Apr :: localhost dbus[]: [system] Activating via systemd: service name='org.freedesktop.nm_dispatcher' unit='dbus-org.freedesktop.nm-dispatcher.service'
Apr :: localhost dbus-daemon: dbus[]: [system] Activating via systemd: service name='org.freedesktop.nm_dispatcher' unit='dbus-org.freedesktop.nm-dispatcher.service'
Apr :: localhost systemd: Starting Network Manager Script Dispatcher Service...
Apr :: localhost dhclient[]: bound to 10.0.0.132 -- renewal in seconds.
Apr :: localhost dbus[]: [system] Successfully activated service 'org.freedesktop.nm_dispatcher'
Apr :: localhost dbus-daemon: dbus[]: [system] Successfully activated service 'org.freedesktop.nm_dispatcher'
Apr :: localhost systemd: Started Network Manager Script Dispatcher Service.
Apr :: localhost nm-dispatcher: Dispatching action 'dhcp4-change' for eno16777736
Apr :: localhost systemd: Started Session of user root.
Apr :: localhost systemd: Starting Session of user root.
Apr :: localhost dhclient[]: DHCPREQUEST on eno16777736 to 10.0.0.254 port (xid=0x398e2136)
Apr :: localhost dhclient[]: DHCPACK from 10.0.0.254 (xid=0x398e2136)
Apr :: localhost NetworkManager[]: <info> address 10.0.0.132
Apr :: localhost NetworkManager[]: <info> plen (255.255.255.0)
Apr :: localhost NetworkManager[]: <info> gateway 10.0.0.2
Apr :: localhost NetworkManager[]: <info> server identifier 10.0.0.254
Apr :: localhost NetworkManager[]: <info> lease time
Apr :: localhost NetworkManager[]: <info> nameserver '10.0.0.2'
Apr :: localhost NetworkManager[]: <info> domain name 'localdomain'
Apr :: localhost NetworkManager[]: <info> (eno16777736): DHCPv4 state changed bound -> bound
Apr :: localhost dbus[]: [system] Activating via systemd: service name='org.freedesktop.nm_dispatcher' unit='dbus-org.freedesktop.nm-dispatcher.service'
Apr :: localhost systemd: Starting Network Manager Script Dispatcher Service...
Apr :: localhost dbus-daemon: dbus[]: [system] Activating via systemd: service name='org.freedesktop.nm_dispatcher' unit='dbus-org.freedesktop.nm-dispatcher.service'
Apr :: localhost dhclient[]: bound to 10.0.0.132 -- renewal in seconds.
Apr :: localhost dbus[]: [system] Successfully activated service 'org.freedesktop.nm_dispatcher'
Apr :: localhost dbus-daemon: dbus[]: [system] Successfully activated service 'org.freedesktop.nm_dispatcher'
Apr :: localhost systemd: Started Network Manager Script Dispatcher Service.
Apr :: localhost nm-dispatcher: Dispatching action 'dhcp4-change' for eno16777736

grep  dbus 3.log |sed -r 's/^.*host (.*): .*$/\1/g'|sed 's/dbus-daemon: //g'|awk  '{print $1}'

过滤关键字                搜索

[root@admin ~]# ss -nat
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN ::: :::*
LISTEN *: *:*
LISTEN ::: :::*
LISTEN *: *:*
LISTEN 127.0.0.1: *:*
LISTEN *: *:*
LISTEN *: *:*
LISTEN ::: :::*
LISTEN ::: :::*
LISTEN *: *:*
LISTEN ::: :::*
LISTEN ::: :::*
LISTEN *: *:*
LISTEN *: *:*
LISTEN ::: :::*
ESTAB 118.188.20.3: 221.122.103.135:
TIME-WAIT 172.16.16.2: 172.16.16.9:
TIME-WAIT 172.16.16.2: 172.16.16.9:
TIME-WAIT 172.16.16.2: 172.16.16.9:
TIME-WAIT 172.16.16.2: 172.16.16.9:
TIME-WAIT 172.16.16.2: 172.16.16.9:
TIME-WAIT 172.16.16.2: 172.16.16.9:
TIME-WAIT 172.16.16.2: 172.16.16.9:

用sed取第一列:

ss -ant|sed 's/[ \t].*//'

取出第一行的指定字符串,后项引用  磁盘使用率

df |sed -nr '/^\/dev/s/([^ ]+).*$/\1/p'

df |sed -nr '/^\/dev/s/.* (.*)%.*/\1/p'

grep、awk、sed的巩固练习的更多相关文章

  1. Linux三剑客-grep || awk || sed

    grep是一个强大的文本搜索工具 命令格式: grep [option] pattren file -a  将二进制文档以文本方式处理 -c  计算找到的符合行的次数 -i  忽略大小写 -n  顺便 ...

  2. Linux查找命令:grep,awk,sed

    grep grep (global search regular expression(RE) and print out the line,全面搜索正则表达式并把行打印出来)是一种强大的文本搜索工具 ...

  3. grep/awk/sed 或者 并且 否定

    Grep 'OR' Operator Find all the lines in a file, that match any of the following patterns. Using GRE ...

  4. 【Linux】linux中文本操作利器grep,awk,sed

    grep命令 grep(global search regular expression)是一种强大的文本搜索工具,它可以使用正则表达式搜索文本,并把匹配的行打印出来.平时搜索文本中内容的时候是非常方 ...

  5. Linux四剑客find/grep/awk/sed

    find ./ -name "*txt" -maxdepth 1 -type f -mtime -2 -exec mv {} ./bbb.txt \; 这条命令表示找当前目录(-m ...

  6. linux shell grep/awk/sed 匹配tab

    处理文件的命令实在是多, sed, awk, grep等.遇到了需要匹配tab的情况, 记录一下. 例子如下:找出文本中第一列是1的行. 文本a 解法1 : 直接使用正则表达式, ^表示开头, \t表 ...

  7. linux相关(find/grep/awk/sed/rpm)

    如何查找特定的文件: find :在指定目录下查找文件 find -name "filename" :从当前目录查找文件 find / -name "filename&q ...

  8. 正则表达式(grep,awk,sed)和通配符

    1. 正则表达式 1. 什么是正则表达式? 正则表达式就是为了处理大量的字符串而定义的一套规则和方法. 通过定义的这些特殊符号的辅助,系统管理员就可以快速过滤,替换或输出需要的字符串. Linux正则 ...

  9. 【linux系统】命令学习(五)linux三剑客 grep \ awk \ sed

    grep----基于正则表达式查找满足条件的行 1.内容检索 获取行 grep pattern file 获取内容 grep -o pattern file 获取上下文grep -A -B -C pa ...

  10. Linux文本三剑客超详细教程---grep、sed、awk

    awk.grep.sed是linux操作文本的三大利器,合称文本三剑客,也是必须掌握的linux命令之一.三者的功能都是处理文本,但侧重点各不相同,其中属awk功能最强大,但也最复杂.grep更适合单 ...

随机推荐

  1. 不能完整读取txt文件问题

    txt文件内容 5 1.3 0.4 3.4 -1.7 16.7 0.89 14.17 4.8 1.34 0.42 3.36 -2 16.2 0.9 14.8 4.9 1.30 0.37 3.51 -1 ...

  2. windows安全更新程序(KB4093112) 安装失败 错误0x80070011

    解决办法:win + R → 输入regedi 将默认安装路径改回C盘的program files

  3. LinkedHashMap源码分析

    hashMap源码分析:hashMap源码分析 版本说明:jdk1.7LinkedHashMap继承于HashMap,是一个有序的Map接口的实现.有序指的是元素可以按照一定的顺序排列,比如元素的插入 ...

  4. JSON获取地址

    JSON获取地址一: https://github.com/stleary/JSON-java JSON获取地址二: http://genson.io/ JSON获取地址一: https://code ...

  5. 数据库常用的事务隔离级别和原理?&&mysql-Innodb事务隔离级别-repeatable read详解

    转载地址:https://baijiahao.baidu.com/s?id=1611918898724887602&wfr=spider&for=pc https://blog.csd ...

  6. jQuery 与 Ajax 的应用

    Ajax 全称为 "Asynchronous JavaScript and XML"(异步 JavaScript 和 XML ),它并不是指一种单一的技术,而是有机地利用了一系列交 ...

  7. bugku web 变量1

    flag In the variable ! <?php error_reporting(0);include "flag1.php";highlight_file(__fi ...

  8. /Date(1555554794000)/ 转换为日期格式

    /Date(1555554794000)/ 转换为 2019/4/18 new Date(parseInt('/Date(1555554794000)/'.substr(6, 13))).toLoca ...

  9. dp-棋盘形dp

    luogu类似题很多的. P1006 传纸条 有不少做法.这里提一个三维做法. 找两条路,可以模拟为有两个人同从(1,1)走到(m,n),走不同的路. 设有k步,则显然2<=k<m+n ( ...

  10. IAR使用跳转功能时不正常的情况

    @2019-04-12 [小记] [使用环境]IAR-Arm8.30.1 [验证] 均为实测 1. 出现如下图这种情况应该是工程所在路径太深导致 2. 如果不弹出上图警告,但还是不跳转应该是工程编译信 ...