大量 sed 取代文字,怎樣比較快 - Linux

By Dora
at 2011-08-22T00:15
at 2011-08-22T00:15
Table of Contents
dear 各位,
我有一個文字檔 a.txt,假設內容是
aaa
bbb
ccc
ddd
eee
...
我想要取代裡面的很多行,
aaa -> AAA
ccc -> CCC
... -> ...
請問用 sed 怎麼做比較快呢
我目前作法是寫很多個 sed
sed -i 's/aaa/AAA/g' a.txt
sed -i 's/ccc/CCC/g' a.txt
sed -i 's/...... ' a.txt
...
雖然能達到效果,可是似乎有點慢
謝謝~
--
我有一個文字檔 a.txt,假設內容是
aaa
bbb
ccc
ddd
eee
...
我想要取代裡面的很多行,
aaa -> AAA
ccc -> CCC
... -> ...
請問用 sed 怎麼做比較快呢
我目前作法是寫很多個 sed
sed -i 's/aaa/AAA/g' a.txt
sed -i 's/ccc/CCC/g' a.txt
sed -i 's/...... ' a.txt
...
雖然能達到效果,可是似乎有點慢
謝謝~
--
Tags:
Linux
All Comments

By Ida
at 2011-08-25T17:51
at 2011-08-25T17:51

By Tristan Cohan
at 2011-08-28T21:08
at 2011-08-28T21:08

By Emma
at 2011-08-29T20:41
at 2011-08-29T20:41

By Isabella
at 2011-09-01T06:29
at 2011-09-01T06:29

By Agatha
at 2011-09-03T10:58
at 2011-09-03T10:58

By Zanna
at 2011-09-06T21:49
at 2011-09-06T21:49

By Hedda
at 2011-09-07T10:36
at 2011-09-07T10:36

By Ina
at 2011-09-09T07:54
at 2011-09-09T07:54

By Iris
at 2011-09-13T20:09
at 2011-09-13T20:09
Related Posts
CentOS 3.9 Bind支援IPv6嗎?

By Annie
at 2011-08-21T15:35
at 2011-08-21T15:35
Mplayer 字幕外框

By Valerie
at 2011-08-21T03:58
at 2011-08-21T03:58
VLC 沒有OpenGL?

By Wallis
at 2011-08-21T03:25
at 2011-08-21T03:25
sendmail 可用domain name順利寄出 但딠…

By Tracy
at 2011-08-21T02:04
at 2011-08-21T02:04
無root權限如何在tty下交換ctrl跟caps lock

By Skylar Davis
at 2011-08-20T23:01
at 2011-08-20T23:01