作者ckt2000 (ckt2000)
看板RegExp
標題[問題] 內文字串該如何用正規表示是表示?
時間Mon Oct 17 12:42:45 2011
/*
聽說註明使用的語言、環境
*
問題有可能較容易被解決...
*/
各位大大:
字串:ABC: asdas@sadasd(單獨一行)
請問,以上字串,想使用sed來取代成另一個字串,
正規表示式該如何表示?
謝謝大家
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 134.208.9.94
1F:→ qwertmn:echo 'ABC: asdas@sadasd'|sed 's/\w*$/newstr/g' 10/17 16:20
2F:→ qwertmn:s/目標字串(可用regexp表示)/取代後字串/g(旗標) 10/17 16:23