我想知道如何替换这个:
.otros{
position: fixed;
top: 116px;
z-index: 100;
left: 0;
}
这样:
.otros{
position: fixed;
top: 70%;
z-index: 100;
left: 0;
}
该文件的内容类似于以下内容:
.social a:not(:hover){
width: 70px;
-webkit-transition: 600ms;
-o-transition: 600ms;
-ms-transition: 600ms;
}
.social div a:not(:hover){
width:200%;
}
.otros{
position: fixed;
top: 116px;
z-index: 100;
left: 0;
}
此命令不起作用:
sed 's/.otros{\ntop*:*;\n}/.otros{\ntop:70%;\n}/g' estilos.css
结果是:
.social a:not(:hover){
width: 70px;
-webkit-transition: 600ms;
-o-transition: 600ms;
-ms-transition: 600ms;
}
.social div a:not(:hover){
width:200%;
}
.otros{
position: fixed;
top: 116px;
z-index: 100;
left: 0;
}
如何替换特定行?
默认情况下,sed 替换在单独的行上运行;要在多行上下文中执行匹配,您需要使用该N
命令将附加行读入模式空间。前任。:
$ sed '/\.otros{/ {N;N;s/top: 116px/top: 70%/}' estilos.css
.social a:not(:hover){
width: 70px;
-webkit-transition: 600ms;
-o-transition: 600ms;
-ms-transition: 600ms;
}
.social div a:not(:hover){
width:200%;
}
.otros{
position: fixed;
top: 70%;
z-index: 100;
left: 0;
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句