0

I want to replace a the entire line in haha.txt that matches a pattern setence.

Orignal: HAHA_IP_TYPE = 1'b1 After : HAHA_IP_TYPE = 1'b0

My command is:

sed -i '/HAHA_IP_TYPE = 1'b1/HAHA_IP_TYPE = 1'b0' haha.txt 

The error message it showed up are:

sed: -e expression #1, char 34: extra characters after command 

Is there anyone can help me understand it? It will be a great help.

Thanks Jeffrey

3
  • You are missing an / at the end of statement. The syntax should be e.g. 's/original text/new text/' Commented Jul 26, 2017 at 10:01
  • @Raman, that's a H command, not an s command. Commented Jul 26, 2017 at 15:06
  • Taken from man page - 's/regexp/replacement/' Commented Jul 26, 2017 at 15:15

1 Answer 1

2

Use double quote since your content has single quote:

sed -i "s/HAHA_IP_TYPE = 1'b1/HAHA_IP_TYPE = 1'b0/" haha.txt 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.