Skip to main content

~/christopher.loessl

TIL: Mac inline sed

How to use inline sed on mac.

I always thought I have to use the gnu tools for inline sed, but I was wrong. Mac sed supports inline editing like this:

sed -i '' '/pattern/d' ./infile

For example to change all my blog posts with the tag tip to til I used

sed -i '' 's/\(tags:.*\)tip\(.*\)/\1til\2/g' *.md