One way to create an alternative name for gsed as sed on OSX that can be used in both the terminal and in bash scripts is to create an alias. You can add the alias to your .bashrc or .bash_profile file for permanent use. Here is an example:
Open your terminal and navigate to your home directory.
Type nano .bashrc
or nano .bash_profile
to edit the file (use the one that exists).
Add the following line: alias sed='gsed'
Save the file and exit the editor.
Type source .bashrc
or source .bash_profile
to apply the changes.
Now, every time you type sed
in your terminal or bash script, it will use the gsed command instead.
Asked: 2022-05-25 11:00:00 +0000
Seen: 10 times
Last updated: Mar 11 '23