2016-04-14 1 views
0

引用符で囲まれたすべての改行を置き換えます。特定の単語の最初の出現後に引用符で囲まれた改行(= n)をsedに置き換えます。

例:

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

結果:

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> 

問題があり、その

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-- 

は、これまでのところ、私はこのsedコマンドを使用しています

も、だから私は唯一の「HTML」の最初の出現後に実行するためにsedコマンドを望む

blablatest 

に変わります。 私は試しました:

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

しかし、それは動作しません。

答えて

1

コマンドの前に/<html>/アドレスを移動:

sed '/<html>/{:a;N;$!ba;$s/=\n//g}' file 
関連する問題