[SED] Replace the content in the file in the SED

xiaoxiao2021-03-06  65

Seeing someone used the SED tool to replace the contents of the file:

Cat Error.h | SED -E S / ^ extern / int / errno /; / # include / /

/> Error.h

So I will work with this usage.

My CVS migrates from the WinNT platform to Linux. The original folder name is not sensitive. Now I need to pay attention, this is not, there is a problem :)

My module is originally webmail_admin, and the name of this folder in the CVS warehouse is webmail_admin, using no problem under Winnt, but after Linux, the problem is coming, I can't find the warehouse.

So I want to batch the repository file in the CVS directory in each directory, this file records the location of the current directory in the warehouse, is WebMail_Admin.

# Cat ChangeRepository.sh #! / bin / shcat $ 1 | SED -E S / ^ Webmail_Admin / Webmail_admin /> $ 1

Then use the find command, find and replace:

Find. -type f -name repository -exec ./changerepository.sh {} /;

Get it!

转载请注明原文地址:https://www.9cbs.com/read-119470.html

New Post(0)