sed 取代問題求教 - Linux
By Erin
at 2020-11-21T20:13
at 2020-11-21T20:13
Table of Contents
原始文檔
xxxxx(可忽略)
Current Frequency:2.412 GHz (Channel 3)
要抽出後面channel的數字
"號稱"原本可行的語法
sed -n 's/[ \\t]*Current Frequency:.*(Channel \\([0-9]*\\))/\\1/p'
不過實際執行是no match
我在https://regex101.com/ 玩了一下
可行的抽出有兩種
[ \\t]*Current Frequency:.*(Channel ([0-9]*))\)
用\2 可以抽出3
[ \\t]*Current Frequency:.*\(Channel ([0-9]*)\)
用\1 就能抽出3
可是把上面兩個丟去GNU sed就掛了....
https://sed.js.org/
輸入
's/[ \\t]*Current Frequency:.*\(Channel ([0-9]*)\) /\1/p'
只會吐原始字串給我...
Current Frequency:2.412 GHz (Channel 3)
請問到底該怎麼取才對呢orz
--
Tags:
Linux
All Comments
By William
at 2020-11-23T11:15
at 2020-11-23T11:15
By Xanthe
at 2020-11-25T02:17
at 2020-11-25T02:17
By Dora
at 2020-11-26T17:19
at 2020-11-26T17:19
By Daniel
at 2020-11-28T08:22
at 2020-11-28T08:22
Related Posts
root 放在 lvm raid 裡無法開機
By Olive
at 2020-11-20T20:32
at 2020-11-20T20:32
make的指令搜尋路徑
By Cara
at 2020-11-18T22:49
at 2020-11-18T22:49
菜雞對WSL的一些疑問
By Heather
at 2020-11-17T15:24
at 2020-11-17T15:24
ubuntu20.04 myslq8.0更新問題
By John
at 2020-11-16T11:05
at 2020-11-16T11:05
時間增減的計算
By Megan
at 2020-11-16T10:31
at 2020-11-16T10:31