and: 1: “…”: invalid command code

use Linux Friends might be more familiar with the command,It can quickly and text documents in batches to operate in the script,For example a row or alternatively change the specific content ......

macOS Naturally have this command,But one thing is not quite the same,If you execute and -i ,So probably you will get a strange error and: 1: “…”: invalid command code


After the query that,This command is a little change in macOS,and It allows you to set a backup file when replacing to avoid data loss - This option is optional in Linux,But in macOS is mandatory,So,In the macOS and -i It will be one more argument,If you did not give,The overall parameter leading to a less,Then an error。


Further reading

  1. “invalid command code .” error from sed after running find and sed on Mavericks
  2. and: 1: “…”: invalid command code on Mac OS

Original article written by Gerber drop-off:R0uter's Blog » and: 1: “…”: invalid command code

Reproduced Please keep the source and description link:

About the Author


The non-declaration,I have written articles are original,Reproduced, please indicate the link on this page and my name。


Leave a Reply

Your email address will not be published. Required fields are marked *