亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

Chinaunix

標(biāo)題: 向高手請(qǐng)教下:pattern space(模式空間) 是什么意思? [打印本頁]

作者: yuyuyou    時(shí)間: 2005-10-02 17:17
標(biāo)題: 向高手請(qǐng)教下:pattern space(模式空間) 是什么意思?
最近看sed1line,出現(xiàn)了2個(gè)詞,老是在我眼前晃。。。

hold space  

pattern space

上面解釋為:

保留空間(內(nèi)存緩沖區(qū))

模式空間

我發(fā)現(xiàn)原文翻譯和解釋的有寫混亂,一開始還說保留空間,最后就不提了,把模式空間說成內(nèi)存緩沖區(qū)了,總之把偶給搞糊涂了。


希望那位高手,能給偶解釋下什么是模式空間,嘿嘿,最好通俗點(diǎn),也最好別說成內(nèi)存緩沖區(qū)啊,那樣偶就更糊涂了。。。     

謝謝了!

    
作者: 寂寞烈火    時(shí)間: 2005-10-02 20:24
標(biāo)題: 向高手請(qǐng)教下:pattern space(模式空間) 是什么意思?
sed在處理文件的時(shí)候,每一行都需要存放在一個(gè)叫“模式空間”的臨時(shí)緩存區(qū)!每處理完一行,便清理一次(pattern space),并把下一行再次放入!
而保留空間(hole space),是當(dāng)sed用到h命令的時(shí)候,把匹配的模式放在一個(gè)叫做"hold buffer"的保留緩沖里,但需要使用G(sed的取得命令)的時(shí)候,sed 從這個(gè)保留空間(hold space)中取得(G),....
PS:這是我的理解!我對(duì)see了解不多!還是讓sed高手釋疑吧
作者: yuyuyou    時(shí)間: 2005-10-03 00:17
標(biāo)題: 向高手請(qǐng)教下:pattern space(模式空間) 是什么意思?
謝謝烈火兄!

叫“模式空間”的臨時(shí)緩存區(qū)--------和-------------叫做"hold buffer"的保留緩沖,,,,,,,,,是不是都在內(nèi)存緩沖區(qū)里呢?


不好意思,可能我的理解能力差,所以,還請(qǐng)高人繼續(xù)點(diǎn)醒我啦。。。

期待!
作者: 寂寞烈火    時(shí)間: 2005-10-03 00:33
標(biāo)題: 向高手請(qǐng)教下:pattern space(模式空間) 是什么意思?
顧名思義,Sed  is a stream editor,那么,sed處理數(shù)據(jù)的地方當(dāng)然是在內(nèi)存里
PS:跟樓主一齊等待  
作者: yuyuyou    時(shí)間: 2005-10-04 21:47
標(biāo)題: 向高手請(qǐng)教下:pattern space(模式空間) 是什么意思?
頂下。
作者: dradhzn    時(shí)間: 2005-10-05 22:09
標(biāo)題: 向高手請(qǐng)教下:pattern space(模式空間) 是什么意思?
following explaination could be small but concise , can treat it as a guideline when you study all the sed commands.

Where SED buffers data
SED maintains two data buffers: the active pattern space, and the auxiliary hold space. In "normal" operation, SED reads in one line from the input stream and places it in the pattern space. This pattern space is where text manipulations occur. The hold space is initially empty, but there are commands for moving data between the pattern and hold spaces.

right, a small practice here for SED command "x" :
'x'  - Exchange the contents of the hold and pattern spaces.

  1. say a file contains following 3 lines ,
  2. #cat file
  3. line1
  4. line2
  5. line3
  6. #
  7. by applying 'x' command, the output is as following :
  8. #sed 'x' file

  9. line1
  10. line2
  11. #
  12. explain :

  13.             <-- first line is empty , because hold space and pattern space exchange the contents , do remember initially the hold space is empty , now hold space contains line1 after first line data manipulation .
  14. line1     <- second output is line1, now hold space contains line2 , and so on a so forth . ^_^
  15. line2
復(fù)制代碼

作者: yuyuyou    時(shí)間: 2005-10-06 22:57
標(biāo)題: 向高手請(qǐng)教下:pattern space(模式空間) 是什么意思?
感謝指點(diǎn)!

理解中。。。
作者: grep_one    時(shí)間: 2005-10-07 13:54
標(biāo)題: 向高手請(qǐng)教下:pattern space(模式空間) 是什么意思?
嘗試過確實(shí)如此,但看了解釋還是不能完全理解,
能說得更詳細(xì)點(diǎn)嗎?
作者: yuyuyou    時(shí)間: 2005-11-23 13:48
剛從一個(gè)帖子里看到的2位高手的:

dbcat:
man sed

h H    Copy/append pattern space to hold space.
                                                                                                                              
g G    Copy/append hold space to pattern space.


waker:
pattern space相當(dāng)于車間sed把流內(nèi)容在這里處理
hold space相當(dāng)于倉庫,加工的半成品在這里臨時(shí)儲(chǔ)存

作者: dbcat    時(shí)間: 2005-11-23 13:53
原帖由 yuyuyou 于 2005-11-23 13:48 發(fā)表
剛從一個(gè)帖子里看到的2位高手的:

dbcat:


waker:


http://930699.k43.opensrs.cn/bbs/index.php?showtopic=744
蠻可愛的小站啊
作者: yuyuyou    時(shí)間: 2005-11-23 13:54

作者: qbqqq    時(shí)間: 2006-03-15 10:18
多看看例子就能理解了!
作者: flowingtree    時(shí)間: 2006-06-20 14:54
原址: http://www.ascc.sinica.edu.tw/nl/83/1018/03.html



學(xué)習(xí)

1.gif (6.54 KB, 下載次數(shù): 65)

1.gif





歡迎光臨 Chinaunix (http://72891.cn/) Powered by Discuz! X3.2