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

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.