Benim örnek dosyası: n n perl one liner kullanılarak nasıl eşleştirilir?
perl -p0e "s#Chorus:(.*?)\n\n#<i>Chorus:$1</i>#gsm" file
sonuç:
As I Come Into Your Presence Key: F 1 As I come into Your presence Past the gates of praise Into Your sanctuary Till we are standing face to face And look upon Your countenance I see the fullness of Your glory And I can only bow down and say <i>Chorus:</i>%
dayana ı tüm koro blok etrafında <i></i>
etiketlerini almak için bu perl tek astar yazdı
As I Come Into Your Presence Key: F 1 As I come into Your presence Past the gates of praise Into Your sanctuary Till we are standing face to face And look upon Your countenance I see the fullness of Your glory And I can only bow down and say Chorus: Your awesome in this place Mighty God You are awesome in this place Abba Father You are worthy of all praise To You our lives we raise You are awesome in this place Mighty God <--- Empty line here <--- Empty line here
Mighty God
'dan sonraki tüm korodan sonra
</i>
etiketinin yazdırılacağı istenen sonucu elde edin.
Hata nerede? Bunu nasıl başarabilirim?
perl -p0e "lar # Koro: \ n \ n # Koro (*.?): $ 1 #gsm \" komut satırında $ – sigmalha
Kullanım tek tırnak .escape dosya perl ifadeleri aksi sarmak için Kabuk genişlemesi başlayacaktır. Alternatif olarak, $ $ gibi @sigmatha önerileri kaçış. – Kenney
Çözüm için @sigmalha teşekkürler. Bu yaptı! –