Unix - Delete a portion which matches a regex

Viewed 82

I have a log file and I am trying to tidy it up to use some data inside. I want to use something like sed 's/foo//g' except that instead of matching the word foo i want it to delete everything from foo until the next space.

I tried (without success):

sed -e -- 's/(?<=foo)(.*)(?= )//g'

Any ideas?

2 Answers
Related