So I have a bunch of lines like this -
$ns duplex-link n1 n2 10mb 10ms DropTail
$ns duplex-link-op n1 n2 10mb 10ms queuePos 0.5
$ns duplex-link n2 n3 10mb 10ms DropTail
$ns duplex-link-op n2 n3 10mb 10ms queuePos 0.5
$ns duplex-link n3 n4 10mb 10ms DropTail
$ns duplex-link-op n3 n4 10mb 10ms queuePos 0.5
Now here's the problem. I want the "10mb 10ms" string removed only where the second word happens to be "duplex-link-op". Therefore I can't do a general replace "10mb 10ms" with a " " command.
On a similar note, how do I do a search and replace of a particular string that happens to occur in a line that has another string? I am guessing it has something to do with backreferences ... but I am unable to find enough tutorials on the web on how to do so :(