1

This question already has an answer here:

Is there a way to use apostrophes ' with the sed command?

I mean this: -

sed '-2 a\\
What's up?' text  

I am talking about the apostrophe in "What's up". If I do it like this it gives me an error "Unmatched"

I tried to escape that apostrophe with \ OR \\ like this What\'s up?, but it doesn't work.

marked as duplicate by don_crissti, jimmij, slm Jul 2 '16 at 14:10

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • and to use an apostrophe in, e.g., a search pattern you can use the octal: \o047 - e.g. sed -n -e '/\o047/p' to print only lines containing an apostrophe. – cas Jul 3 '16 at 13:46
2
sed '2 a\ 
What'\''s up?' text

or

sed "2 a\ 
What's up?" text

Not the answer you're looking for? Browse other questions tagged or ask your own question.