2

I have an error on MAC OS X when I'm using sed, which looks like so:

sed -i '' '/user_pref("mail.identity.id1.reply_on_top", 1);/ a\
user_pref("mail.identity.id1.sig_file", "/Users/nicolas.hulot/Library/Mail/V2/MailData/Signatures/signature.html");
user_pref("mail.identity.id1.sig_file-rel", "[ProfD]../../../Mail/V2/MailData/Signatures/signature.html");
' ~/Library/Thunderbird/Profiles/*.default/prefs.js

When I change the second and third line by another string like 'abcdefgh...' it's good, but with this string which has a lot of specials characters it's too wrong.

The error which appears is:

sed: 3: "/user_pref("mail.identi ...": invalid command code u

1 Answer 1

2

The newline for sed's append is break it, so you have to backslash newline or sustitute by \n symbol:

sed -i '' '/user_pref("mail.identity.id1.reply_on_top", 1);/ a\
user_pref("mail.identity.id1.sig_file", "/Users/illias.seba/Library/Mail/V2/MailData/Signatures/signature.html");\
user_pref("mail.identity.id1.sig_file-rel", "[ProfD]../../../Mail/V2/MailData/Signatures/signature.html");\
' ~/Library/Thunderbird/Profiles/*.default/prefs.js

or

sed -i '' '/user_pref("mail.identity.id1.reply_on_top", 1);/ a\
user_pref("mail.identity.id1.sig_file", "/Users/illias.seba/Library/Mail/V2/MailData/Signatures/signature.html");\nuser_pref("mail.identity.id1.sig_file-rel", "[ProfD]../../../Mail/V2/MailData/Signatures/signature.html");\n' ~/Library/Thunderbird/Profiles/*.default/prefs.js
0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.