SED: replace a pattern in all files in one command

I have a bunch of c files and I want to change the first line that appears as


//something

into

/*something

Using sed, you can use the command ‘s/old_pattern/new_pattern/g’ where -e stands for edition, and -i to apply the changes. If you just want to see what would be the outcome, do not use the -i option.


sed -i -e 's/\/\/$Id/\/*$Id/g' *.c

Please follow and like us:
This entry was posted in Linux and tagged . Bookmark the permalink.

Leave a Reply

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