Quantcast
Viewing all articles
Browse latest Browse all 16

Answer by Jon for sed in-place flag that works both on Mac (BSD) and Linux

Portable script for both GNU systems and OSX:

if [[ $(uname) == "Darwin" ]]; then    SP=" " # Needed for portability with sedfised -i${SP}'' -e "s/foo/bar/g" -e "s/ping/pong/g" foobar.txt

Viewing all articles
Browse latest Browse all 16

Trending Articles