Set GNU SED (gsed) as default sed in Mac.

GNU SED (gsed) uses the same grammar as the one in CentOS or Ubuntu. I really dislike sed in Mac.

So you need to install GNU SED. Please check other places about the installment.

Then your gsed is at /opt/local/bin/gsed.

Your Mac sed is at /usr/bin/sed.

Use the following command to make a backup for Mac sed and build a soft link between gsed and sed.

sudo mv /usr/bin/sed /usr/bin/sed_backup

ln -s /opt/local/bin/gsed /usr/bin/sed

Now you may use GNU SED gsed as the default sed in Mac.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s