0

I want to replace a string "#security" with "security\n\tauthorization : enabled" in a file file.txt. Here \n represents a new line and \t for tab. How can I do this using sed command.

3
  • 2
    Seems like a homework question... Jul 1, 2016 at 5:32
  • This is very basic. There's tons and tons of similar questions that has been asked , and there's tons and tons of resources for basic sed on google. Do your research. We are not free "do my homework" service Jul 1, 2016 at 5:46
  • I'm voting to close this question as off-topic because it seems like homework Jul 1, 2016 at 5:46

1 Answer 1

1
sed 's/#security/security\n\tauthorization : enabled/' file

If you want to edit your file "in place" use sed's option -i.


See: man sed

Not the answer you're looking for? Browse other questions tagged .