gpt4 book ai didi

shell - grep/sed/awk 删除某一行之前的所有内容

转载 作者:行者123 更新时间:2023-12-03 04:16:16 25 4
gpt4 key购买 nike

我的命令具有以下原始输出

Wi-Fi:

Software Versions:
CoreWLAN: 2.1.1 (211.3)
CoreWLANKit: 1.0.1 (101.1)
Menu Extra: 7.0.1 (701.2)
configd plug-in: 7.1.1 (711.1)
System Profiler: 7.0 (700.3)
IO80211 Family: 4.1.1 (411.1)
WiFi Diagnostics: 1.0.1 (101.1)
AirPort Utility: 5.5.3 (553.20)
Interfaces:
en1:
Card Type: AirPort Extreme (0x14E4, 0xD6)
Firmware Version: Broadcom BCM43xx 1.0 (5.100.98.75.18)
MAC Address: xx:xx:xx:xx:xx:xx
Locale: FCC
Country Code: US
Supported PHY Modes: 802.11 a/b/g/n
Supported Channels: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165
Wake On Wireless: Supported
AirDrop: Supported
Status: Connected
**Current Network Information:**
PEETS:
PHY Mode: 802.11g
BSSID: 00:17:c5:0c:85:50
Channel: 6
Country Code: US
Network Type: Infrastructure
Security: None
Signal / Noise: -52 dBm / -89 dBm
Transmit Rate: 54
Other Local Wi-Fi Networks:
hpsetup:
PHY Mode: 802.11b
BSSID: ba:78:b7:86:78:69
Channel: 6
Network Type: Computer-to-Computer
Security: None
Signal / Noise: -90 dBm / -92 dBm
yogurtland:
PHY Mode: 802.11g
BSSID: 0c:d5:02:7b:ce:5b
Channel: 11
Network Type: Infrastructure
Security: WEP
Signal / Noise: -72 dBm / -92 dBm

但是,我只想要“当前网络信息:”之后的信息。计算之前的行数不起作用,因为该信息是可变的。另外,英镑符号也是我加上去的。请忽略他们

最佳答案

使用awk:

awk '/Current Network Information/,0' INPUT_FILE

使用sed:

sed -n '/Current Network Information/,$p' INPUT_FILE

关于shell - grep/sed/awk 删除某一行之前的所有内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8810796/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com