Reputation: 15
I have a file which contains section I'd like to delete:
mu->doe = '( tr <br>
tekt ( tr uapp "(Finction rood (\;)<br>
ord ( a b c)<br>
)<br>
mu->Koe = '( tr<br>
tekt ( tr uapp "(Finction rood (\;)..<br>
ord ( a b c)<br>
)<br>
mu->Yoe = '( tr <br>
tekt ( tr uapp "(Finction rood (\;)<br>
ord ( a b c)<br>
)<br>
I need to remove mu-> Koe
section resulting text in the file should be:
mu->doe = '( tr <br>
tekt ( tr uapp "(Finction rood (\;)<br>
ord ( a b c)<br>
)<br>
mu->Yoe = '( tr <br>
tekt ( tr uapp "(Finction rood (\;)<br>
ord ( a b c)<br>
)<br>
I used sed:
sed -e '/mica/,+5d'
but the number of lines may vary and will not be good solution.. Either sed, tcl or any script will be helpful..
Upvotes: 1
Views: 68
Reputation: 246847
Perhaps:
sed '/mu->Koe/,/^)$/d' file
That will delete from the Koe line to the next line containing only a right parenthesis. You may need to adjust the 2nd pattern to account for whitespace.
Upvotes: 1