Share & learn

Through Innovative Digital Library

How to insert a comment at the beginning all line by using sed command?

How to insert a comment at the beginning all line by using sed command?
 



Answers

Posted by chandu on December 11th 2017 07:15 AM

This example shows how to add a character to the beginning of each line using a sed command and bashshell. Let’s create example file with some text. Add character at the beginning of each line using sed command. For example to add # in front of each line we can use sed command with following syntax:

# sed ‘s/^/#/’ file
Answer Question

Your email address will not be published. Required fields are marked *

  • Minimum 20 character
L6HP

related questions

Most liked questions

Most answered questions

Login
L6HP Refresh
Register
L6HP Refresh
Forgot password
Ask a Question
Minimum 20 character
Minimum 20 character
Reply
Minimum 20 character
L6HP Refresh