entradas:
line1 with the PATTERN that contains ( )
line2 with the PATTERN that contains ( )
lineN with the PATTERN that contains ( )
salidas:
line1 with the PATTERN that contains ( ) ;
line2 with the PATTERN that contains ( ) ;
...
lineN with the PATTERN that contains ( ) ;
Intenté esto:
find . -name "test.txt" -print | xargs sed -i "/PATTERN/ s/$)/); /g"
Pero no funcionó.
shell
sed
line-editor
usuario3342338
fuente
fuente

-exec ... +lugar de-exec ... \;, si su búsqueda lo permite.Suponiendo que eso
PATTERNes realmente( )y que algo podría interponerse entre( )y que no están necesariamente al final de la línea:fuente
Usando
ex(que es equivalente avi -e/vim -e).Un archivo:
Todos los
test.txtarchivos de forma recursiva:Nota: Asegúrese de que la opción global (
**) esté habilitada por:shopt -s globstarsi su shell lo admite.Nota: El
:bufdocomando no es POSIX .fuente
Tratar:
fuente