2009/7/16 San Martín, Matías <[email protected]> > You can specify two regular expressions as the range. Assuming a "#" > starts a comment, you can search for a keyword, remove all comments until > you see the second keyword. In this case the two keywords are "start" and > "stop:" > > sed '/start/,/stop/ s/#.*//' > > The first pattern turns on a flag that tells *sed* to perform the > substitute command on every line. The second pattern turns off the flag. If > the "start" and "stop" pattern occurs twice, the substitution is done both > times. If the "stop" pattern is missing, the flag is never turned off, and > the substitution will be performed on every line until the end of the file. > > You should know that if the "start" pattern is found, the substitution > occurs on the same line that contains "start." This turns on a switch, which > is line oriented. That is, the next line is read and the substitute command > is checked. If it contains "stop" the switch is turned off. Switches are > line oriented, and not word oriented. > > ie. algo del estilo > > sed '/<b>/,/<\/b>/ s/\(Titulo: \)*.**/\1*OTRO ALGO*<\/b>/' > > debería andar >
Gracias a todos. Me sirvió mucho! Un día de estos me voy a tener que hacer un seminario de las oscuras artes del regexp... =D Saludos
_______________________________________________ Lista de correo Programacion. [email protected] http://listas.fi.uba.ar/mailman/listinfo/programacion
