Lingua Franca - Error on Task 16 (sed)

I used the proper code given in the solutions:

sed -i ‘s/Lingua-Franca/Lingua Franca/g’ */ *.txt

however my Terminal returns the following:

sed: 1: “africa/afrihili.txt”: command a expects \ followed by text

Anyone can help? I’m using zsh for Mac


This issue has cropped up before, see the following thread(s) for a little discussion and some potential solutions-

The instructions appear to be written for a GNU version of sed whereas the mac is using a BSD version. If you’re uncertain about the sed command on a given system then man sed may help.


It’s a good heads up for working with linux/unix. Different versions can give subtle but big differences (like for example, the default python3 version that installs when you’re setting things up). These are definitely things I wish I realized earlier…

1 Like

Adding the -e argument worked on newer MacOS

sed -i’Lingua-Franca’ -e ‘s/Lingua-Franca/Lingua Franca/g’ /.txt


Could you please explain why you inserted ‘Lingua-Franca’ after the -i?
And what does the -e do?

Whenever you are on the command-line you can type man [command] to read the manual about whatever command you’re curious about.

For example here you can type man sed and read what the flags do. Specifically for -e:

 -e command
         Append the editing commands specified by the command argument
         to the list of commands.

From this you can see that what follows -e has to be a command. In this case it is s/Lingua-Franca/Lingua Franca/g (which is a type of search command).


This did not work for me on macOS 10.13.06(tried copy pasting).
Screen Shot 2021-10-14 at 2.33.01 PM

Tried adding space right after “-i” command, did not work.

Zero-length extension as found in “man sed” did not work too.

Changing the file path and using wildcard “/.txt” did not work and solutions on stack overflow did not help too.

Wasn’t working for me so followed this:

Basically the format on MacOS is: sed -i ‘[extension]’ ‘s/Lingua-Franca/Lingua Franca/g’ wildcard/wildcard.txt

[extension] will be what it is saved as as a backup i believe (talks about it in the link).
But can leave it blank and just put ’ ’ if you don’t want one i think? (I’m really new to all this, but it worked for me!)

so I used: sed -i ‘’ ‘s/Lingua-Franca/Lingua Franca/g’ wildcard/wildcard.txt

(wildcard = asterisk)