I have a requirement where we need to replace a word in a file which can be different everytime I execute the script, the content of the file is
class DynamicContentToReplace > Something
Here I need to use sed command to replace [DynamicContentToReplace] with RequiredContent. The [DynamicContentToReplace] could include everything except white spaces.
Assumptions we can take is that the file will only contain one such line containing
class RequiredContent > Something
I have tried the following command
sed -e "s/\(class \)\([^\s]+\)/\1RequiredContent/" but it still does not replace the content. What am i missing here. I have gone through this post as well. But couldn't get the solution.