Question onesed edit command: "Sed-i ' s/a/b/g ' Test.txt"
Error:sed:1: "test.txt": Undefined label ' est.txt '
Solution: Add a backup with the appended name "Sed-i". Bak ' s/a/b/g ' test.txt " Cause: Mac forced backup, otherwise errorof course you can not use the other backup name, just ", you can keep only one copysed-i ' s/a/b/g ' test.txt
question twosed append command: "sed-i" "/a/a\xxx" test.txt "match to a character and append XXX content
Error:sed:1: "2a\test\": extra characters after \ At the end of a command
Solution: wrap the line before appending the content, and use a double slash \ \sed-i ' "/a/a\\xxx "Test.txt However, there is a new problem, the append is displayed in front of the next line, there is no independent occupy a rowuse \\n Ah \ \ Nothing is invalid, in fact, as long as
the string directly after the input \ \ and then return to the line is valid, as shown in.
Note: insert a line with/I before a row, for example, before matching to a in the previous row join YYYsed-i ' "/a/i\\xxx "Test.txt The sed-n on your Mac is like the way you use it on a Linux system
Edit-I command on Mac to perform sed sed:1: "test.txt": Undefined label ' est.txt ' or sed:1: ' 2a\test\ ': extra characters after \ at the end O F a command