2016-04-14 37 views
0

Her alıntılanabilen yeni satırı değiştirmek istiyorum, ancak yalnızca belirli bir kelimenin ilk oluşmasından sonra.Belirtilen yazdırılabilir yeni satırları (= n), belirli bir sözcüğün ilk oluşmasından sonra sed ile değiştir

Örnek:

sed ':a;N;$!ba;$s/=\n//g' 

Sonuç:

blablatest 

--69c1683a3ee16ef7cf16edd700694a2f 
Content-Type: text/html; charset=ISO-8859-1 
Content-Transfer-Encoding: quoted-printable 

<html> 
<head> 
<title>Testing Manuel Lemos' MIME E-mail composing and sending PHP class: HTML message</title> 
<style type="text/css"><!-- 
body { color: black ; font-family: arial, helvetica, sans-serif ; background-color: #A3C5CC } 
A:link, A:visited, A:active { text-decoration: underline } 
--></style> 
</head> 
<body> 
<table background="cid:4c837ed463ad29c820668e835a270e8a.gif" width="100%"> 
<tr> 
<td> 
<center><h1>Testing Manuel Lemos' MIME E-mail composing and sending PHP class: HTML message</h1></center> 
<hr> 
<P>Hello Manuel,<br><br> 
This message is just to let you know that the <a href="http://www.phpclasses.org/mimemessage">MIME E-mail message composing and sending PHP class</a> is working as expected.<br><br> 
<center><h2>Here is an image embedded in a message as a separate part:</h2></center> 
<center><img src="cid:ae0357e57f04b8347f7621662cb63855.gif"></center>Thank you,<br> 
mlemos</p> 

problem,

blabla= 
test 

blabla= 
test 

--69c1683a3ee16ef7cf16edd700694a2f 
Content-Type: text/html; charset=ISO-8859-1 
Content-Transfer-Encoding: quoted-printable 

<html> 
<head> 
<title>Testing Manuel Lemos' MIME E-mail composing and sending PHP class: H= 
TML message</title> 
<style type=3D"text/css"><!-- 
body { color: black ; font-family: arial, helvetica, sans-serif ; backgroun= 
d-color: #A3C5CC } 
A:link, A:visited, A:active { text-decoration: underline } 
--></style> 
</head> 
<body> 
<table background=3D"cid:4c837ed463ad29c820668e835a270e8a.gif" width=3D"100= 
%"> 
<tr> 
<td> 
<center><h1>Testing Manuel Lemos' MIME E-mail composing and sending PHP cla= 
ss: HTML message</h1></center> 
<hr> 
<P>Hello Manuel,<br><br> 
This message is just to let you know that the <a href=3D"http://www.phpclas= 
ses.org/mimemessage">MIME E-mail message composing and sending PHP class</a= 
> is working as expected.<br><br> 
<center><h2>Here is an image embedded in a message as a separate part:</h2>= 
</center> 
<center><img src=3D"cid:ae0357e57f04b8347f7621662cb63855.gif"></center>Than= 
k you,<br> 
mlemos</p> 
</td> 
</tr> 
</table> 
</body> 
</html> 
--69c1683a3ee16ef7cf16edd700694a2f-- 

Şimdiye kadar bu sed komutu kullanıyorum

blablatest 

Yani sed komutu sadece "html" ilk oluşumu sonrasında yürütmek istiyoruz içine

da döner.

sed ':a;N;$!ba;/html/,$s/=\n//g' 

Ama çalışmıyor: denedim.

cevap

1
komutları önce /<html>/ adresi Taşı

:

sed '/<html>/{:a;N;$!ba;$s/=\n//g}' file