I used sed to accomplish this but it changed all the line endings in my files and I think it would be good for me to learn how the same thing can be accomplished in Powershell, anyway.
I have a folder with many sub-folders of c/c++ code. I need to recurse through each folder and replace a multi-line header with a single-line header.
The current header looks like:
<code>/************************************************************************************ ///_|
File: $Id: //perforcedepot/path/file.ext#1 $
LEGAL NOTICE: COPYRIGHT Company Inc., All Rights Reserved
*************************************************************************************/ //|_/
</code>
<code>/************************************************************************************ ///_|
File: $Id: //perforcedepot/path/file.ext#1 $
LEGAL NOTICE: COPYRIGHT Company Inc., All Rights Reserved
*************************************************************************************/ //|_/
</code>
/************************************************************************************ ///_|
File: $Id: //perforcedepot/path/file.ext#1 $
LEGAL NOTICE: COPYRIGHT Company Inc., All Rights Reserved
*************************************************************************************/ //|_/
The new header is:
<code>// Copyright company name - url
</code>
<code>// Copyright company name - url
</code>
// Copyright company name - url
How can this be done with Powershell?