Usando gawk
:
gawk -i inplace '/.org-link {/,/}/ {if($0~/text-decoration: underline/) next} {print}' infile
Isso excluirá somente text-decoration: underline
atributos em uma classe .org-link
:
user@debian ~ % cat infile
.org-link {
/* org-link */
color: #b58900;
font-weight: bold;
text-decoration: underline;
}
.org-link1 {
/* org-link */
color: #b58900;
font-weight: bold;
text-decoration: underline;
}
.org-link {
/* org-link */
color: #b58900;
font-weight: bold;
text-decoration: underline;
}
user@debian ~ % gawk -i inplace '/.org-link {/,/}/ {if($0~/text-decoration: underline/) next} {print}' infile
user@debian ~ % cat infile
.org-link {
/* org-link */
color: #b58900;
font-weight: bold;
}
.org-link1 {
/* org-link */
color: #b58900;
font-weight: bold;
text-decoration: underline;
}
.org-link {
/* org-link */
color: #b58900;
font-weight: bold;
}
Para executar um loop sobre vários arquivos HTML no mesmo diretório de trabalho, você pode usar um loop bash
for
com curingas:
for f in *.html; do gawk -i inplace '/.org-link {/,/}/ {if($0~/text-decoration: underline/) next} {print}' "$f"; done