以下 sed 命令在大多数情况下都运行良好,除非我使用以下脚本尝试它。我收到错误
sed: -e expression #1, char 3495: unterminated address regex
它指向最后一个字符 } 但我不知道如何终止 sed 命令。通常这不是问题。赫普将不胜感激。
sed -i '/body *{/,/}/c \
body{\
z-index:1;\
margin:0;\
background-image: url("http://www.calmchess.com/images/frgrnd1366.png");\
background-repeat:repeat;\
}\
\
#header0{\
position:relative; \
width:1100px; \
height:114px; \
text-align:center; \
font-size:16px; \
color:000000; \
background-size:1100px 114px; \
background-image: url("http://www.calmchess.com/images/854x480/header854x480_114_0.png"); \
background-repeat: no-repeat; \
}\
\
#fullcontentcontainer0{ \
position:relative; \
z-index:0; \
text-align:center; \
font-size:16px; \
color:000000; \
width:1100px; \
height:135%; \
} \
\
#lrgcontentimgcontainer0{ \
position:relative; \
top:75px; \
margin:0 auto 0 auto; \
font-size:16px; \
color:000000; \
width:530px; \
height:575px; \
background-size:530px 575px; \
background-image: url("http://www.calmchess.com/images/lrgcontent0.png"); \
background-repeat: no-repeat; \
} \
\
#nav0{ \
width:1100px; \
height:60px; \
position:absolute; \
color:000000; \
z-index:6; \
font-size:16px; \
border-top:1px solid 000000; \
border-bottom:1px solid 000000; \
background-image:url("http://www.calmchess.com/images/mediumformbak0.png");\
background-repeat: no-repeat; \
} \
\
.btncon0{ \
position:relative; \
width:205px; \
height:60px; \
margin:0 auto 0 auto; \
} \
\
#footer0{ \
position:absolute; \
top:100%; \
width:100%; \
height:180px; \
font-size:16px; \
border-top:1px solid 000000; \
background-image: url("http://www.calmchess.com/images/mediumformbak0.png"); \
background-repeat: no-repeat; \
} \
\
.foliotop0{ \
position:absolute; \
width:100px; \
height:35px; \
top:5px; \
left:0px; \
font-size:16px; \
z-index:2; \
background-size:100px 35px; \
background-image: url("http://www.calmchess.com/images/port0.png"); \
background-repeat: no-repeat; \
} \
\
.foliobottom0{ \
position:absolute; \
width:100px; \
height:35px; \
top:5px; \
left:0px; \
font-size:16px; \
z-index:1; \
background-size:100px 35px; \
background-image: url("http://www.calmchess.com/images/buttonbottom0.png"); \
background-repeat: no-repeat; \
} \
\
.contacttop0{ \
position:absolute; \
width:100px; \
height:35px; \
top:5px; \
left:105px; \
font-size:16px; \
z-index:2; background-size:100px 35px; \
background-image: url("http://www.calmchess.com/images/contact0.png"); \
background-repeat: no-repeat; \
} \
\
.contactbottom0{ \
position:absolute; \
width:100px; \
height:35px; \
top:5px; \
left:105px; \
font-size:16px; \
z-index:1; \
background-size:100px 35px; \
background-image: url("http://www.calmchess.com/images/buttonbottom0.png"); \
background-repeat: no-repeat; \
} \
\
#paypal0{ \
position:absolute; \
left:460px; \
top:840px; \
font-size:21pt;\
} \
\
#paypal0 input{ \
width:300px; \
height:150px; \
} \
\
#para0{ \
font-size:21pt; \
position:absolute; \
width:500px; \
left:15px; \
top:10px; \
text-align:left; \
} \
\
#para1{ \
font-size:21pt; \
position:absolute; \
width:500px; \
left:15px; \
top:110px; \
text-align:left; \
} \
\
#para2{ \
font-size:21pt; \
position:absolute; \
width:500px; \
left:15px; \
top:350px; \
text-align:left; \
} \
\
#para3{ \
font-size:21pt; \
position:absolute; \
width:500px; \
left:15px; \
top:445px; \
text-align:left; \
} \
\
.businesscard0{ \
width:640px; \
height:480px; \
margin:0 auto 0 auto; \
font-size:16px; \
}' $file0
最佳答案
如果您想要用反斜杠来标记换行符,则不允许尾随空格。
cat -n file_with_sed_code | grep '\\ \+$'
关于linux - css sed未终止的地址正则表达式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47273600/