Delete a line in file based on search criteria / R

2019-09-20 11:12发布

问题:

I have a .csproj file which has entries like:

<Content Include="somepath1\somedir2\dir3\Thumbs.db" /> 

<Content Include="newpath\somedir2\Thumbs.db" /> 

<Content Include="anotherpath\somedir1\dir3\dir4\Thumbs.db" />

They are scattered all over the file.

What I am looking for is to use Visual Studio(Preferred) or other tool to delete the entire line by Search/Replace.

回答1:

If you want to remove all the content include, you can use a simple regex like this:

<Content Include=.*?\/>

On the other hand, if you want to remove the thumbs then you can use

<Content Include=".*?Thumbs.db.*?\/>

Working demo