關於正規表示 - Linux

By David
at 2015-01-15T11:37
at 2015-01-15T11:37
Table of Contents
板友好
有一個檔案 tunnel_list 內容為
tunnel1
tunnel2
tunnel3
我寫了一個 script: remove_tunnel.sh 內容為
#!/bin/bash
sed -i 's/$1//g' tunnel_list
sed -i '/^$/d' tunnel_list
並在 shell 中丟入參數
./remove_tunnel.sh tunnel1
它無法刪除 tunnel1,因為$在sed中好像代表句尾,請問我參數1在 sed 中
要怎表示呢? 謝謝
--
有一個檔案 tunnel_list 內容為
tunnel1
tunnel2
tunnel3
我寫了一個 script: remove_tunnel.sh 內容為
#!/bin/bash
sed -i 's/$1//g' tunnel_list
sed -i '/^$/d' tunnel_list
並在 shell 中丟入參數
./remove_tunnel.sh tunnel1
它無法刪除 tunnel1,因為$在sed中好像代表句尾,請問我參數1在 sed 中
要怎表示呢? 謝謝
--
Tags:
Linux
All Comments

By Irma
at 2015-01-17T07:47
at 2015-01-17T07:47

By Charlotte
at 2015-01-20T02:47
at 2015-01-20T02:47

By Dorothy
at 2015-01-23T06:07
at 2015-01-23T06:07

By Christine
at 2015-01-27T13:56
at 2015-01-27T13:56

By Hedy
at 2015-01-31T06:36
at 2015-01-31T06:36
Related Posts
docker 的port mapping

By Anthony
at 2015-01-14T17:00
at 2015-01-14T17:00
現在你可以下載北韓優質作業系統紅星3.0

By Lydia
at 2015-01-14T15:44
at 2015-01-14T15:44
skype字太小 ubuntu 14.04

By Connor
at 2015-01-14T12:31
at 2015-01-14T12:31
evernote取代方案 ubuntu14.04

By Callum
at 2015-01-14T11:29
at 2015-01-14T11:29
QQ 於 Ubunutu 14.04

By Edith
at 2015-01-14T11:24
at 2015-01-14T11:24