










Sig: Trasferencia de Control Condicional
Sup: Expresiones Regulares en sed
Ant: Transferencia de Control
Err: Si hallas una errata ...
El uso de llaves {, } permite ejecutar los comandos en la lista entre llaves
a las líneas seleccionadas. La llave que cierra debe estar en su propia línea aparte.
Las llaves nos permiten, como se ve en el ejemplo, anidar selecciones
y expresar condiciones del tipo ``si esta entre estos dos patrones y además
está entre estos otros dos ...''.
Los comandos a e i tienen una sintaxis parecida:
[address]a
|
[address]i
|
text |
text |
a añade (i inserta) el texto en cada línea que
casa con la dirección especificada.
El text no queda disponible en el ``pattern space'',
de manera que los subsiguientes comandos no le afectan. El
siguiente ejemplo convierte un fichero ascii a html:
$ cat aandi.sed
1{
i\
<html>\
<head>\
<title>
p
i\
</title>\
</head>\
<body bgcolor=white>
}
$a\
</pre>\
</body>\
</html>
$ cat aandi.test
hello.world!
$ sed -f aandi.sed aandi.test
<html>
<head>
<title>
hello.world!
</title>
</head>
<body bgcolor=white>
hello.world!
</pre>
</body>
</html>











Sig: Trasferencia de Control Condicional
Sup: Expresiones Regulares en sed
Ant: Transferencia de Control
Err: Si hallas una errata ...
Casiano Rodríguez León
2012-05-22