2016-11-10 122 views
1

我有一個重複模式的數據集之間的重複模式:正則表達式來匹配兩個字符串

---- 
MV: The Oxford and Cambridge University Boat Race (1895) 
SD: 30 March 1895 - 
---- 
MV: Awakening of Rip (1896) 
CP: American Mutoscope Company; 4 February 1897; 9237 (in copyright registry) 
PD: August 1896 - August 1896 
---- 
MV: A Chegada do Comboio Inaugural à Estação Central do Porto (1897) 
PD: 7 November 1896 - 
---- 
MV: Exit of Rip and the Dwarf (1896) 
CP: American Mutoscope and Biograph Co.; 9 December 1902; H24875 (in copyright registry) 
PD: August 1896 - August 1896 
---- 

現在,我願意回答大家的第一和未來串之間有什麼和改變\n\t,使每個條目將在相同的行選項卡中分隔。 。每個條目,然後將分開所以它會更容易在閱讀中到底應該是這樣的:

---- 
MV: The Oxford and Cambridge University Boat Race (1895) SD: 30 March 1895 - 
---- 
MV: Awakening of Rip (1896) CP: American Mutoscope Company; 4 February 1897; 9237 (in copyright registry) PD: August 1896 - August 1896 
---- 
MV: A Chegada do Comboio Inaugural à Estação Central do Porto (1897) PD: 7 November 1896 - 
---- 
MV: Exit of Rip and the Dwarf (1896) CP: American Mutoscope and Biograph Co.; 9 December 1902; H24875 (in copyright registry) PD: August 1896 - August 1896 
---- 

我已經有一些積極的回顧後發模式嘗試,但沒有運氣。

+0

好吧,我設法在這裏做的正則表達式:https://regex101.com/r/xC7qJ2/5但我掙扎在使用SED的匹配\ t替換\ n。有任何想法嗎? –

回答