You can use the magic paramater --
to tell most versions of sed
(as well as many other CLI tools) that you are done giving it switches (which generally start with -
or --
) and the remainder of the command line should be parsed as arguments. As such:
$ sed --in-place 's/^CREATE DATABASE.*$//' -- world.sql
Using the substitution command in this place where you are removing the entire line might, though, be more succinctly done with:
$ sed --in-place '/^CREATE DATABASE/d'
Your question also is tagged with MacOS. Macs use the BSD versions of some tools such as sed
rather than the version usually included in Linux, and requires an actual parameter for --in-place
. However, this parameter, if an empty string, behaves as it does on other POSIXes:
$ sed --in-place '' '/^CREATE DATABASE/d'