Answers for "sed command regular expression to replace all occurences"

2

sed replace all occurances?

echo dog dog dos | sed -e 's:dog:log:g'

#You can also use the above answer with appropriate slashes like
echo "grepper is a nice grepper" | sed "s/grepper/blow/g"
Posted by: Guest on June-17-2020
-1

sed replace from match

Just use a similar example with using ".*" regex with sed as following:
sed 's/match_pattern.*/replacement_of_match_and_rest_of_line/' file.txt
Posted by: Guest on November-05-2020

Code answers related to "sed command regular expression to replace all occurences"

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language