Reputation: 613
There are two instances of a word music
in a file.
Hello music
Goodbye music
If I were to use sed to replace an instance of music
only where grep Hello
is applied, what would I need to add to a sed
comand?
Currently sed -i -e "s/$olmusic/$newmusic/g" file.txt
replaces every instance of $oldmusic in a file but I need it to replace only the one where condition of grep
is met.
Upvotes: 0
Views: 45