[英]Remove whole (or multiple) line with search and replace in eclipse
I've got about 200 Java files and I want to remove the following line within eclipse all over the 200 files:我有大约 200 个 Java 文件,我想在这 200 个文件中删除 eclipse 中的以下行:
public static final String ID = "@(#) $Id: LoginView.java 457 2015-10-26 12:52:10Z $";
The varibale content in this line is @(#) $Id: LoginView.java 457 2015-10-26 12:52:10Z $
这一行的可变内容是@(#) $Id: LoginView.java 457 2015-10-26 12:52:10Z $
How can I search for all of the lines and delete them?如何搜索所有行并将其删除?
What to do, if I have a commentary eg如果我有评论该怎么办,例如
//*****************************************************************************
//
// Copyright (c) 2015
// All rights reserved
//
// The contents of this file is an unpublished work protected.
//
// This software is proprietary to and emboddies confidential
// technology of abc. Possession, use and copying
// of the software and media is authorized only pursuant to a
// valid written license. This copyright
// statement must be visibly included in all copies.
//
//*****************************************************************************
//*****************************************************************************
//
// $Revision: 457 $ ($Date: 2015-10-26 13:52:10 +0100 (Mo, 26 Okt 2015) $)
//
// filename : LoginView.java
//
// contents :
//
//*****************************************************************************
The variable content is the last part and here it is the same: I want to remove the WHOLE commentary in eclipse in each file.变量内容是最后一部分,这里是相同的:我想删除每个文件中 eclipse 中的整个评论。
How to achieve this?如何做到这一点?
You can do text search by using Ctrl+H with scope as workspace like explained in another answer , but you can use the replace within the Ctrl+H window of eclipse to achieve the deletion and don't need to use Ctrl+F.您可以使用 Ctrl+H 和 scope 作为工作区进行文本搜索,如另一个答案中所述,但您可以在 eclipse 的 Ctrl+H window 中使用替换来实现删除,不需要使用 Ctrl+F。
To delete multi-line you can enable the "Regular expression"-Checkbox.要删除多行,您可以启用“正则表达式”-复选框。
You dont have to write the Regex yourself, just mark the text and open Ctrl+H again after the activation of the checkbox.您不必自己编写正则表达式,只需标记文本并在激活复选框后再次打开 Ctrl+H。
You can do text search by using Ctrl+h with scope as workspace then it will be searched in all projects in the workspace and will show in search result. 您可以使用Ctrl + h(范围为工作空间)来进行文本搜索,然后将在工作空间中的所有项目中进行搜索并将其显示在搜索结果中。 Now for each file do Ctrl+F and replace it. 现在,对每个文件执行Ctrl + F并将其替换。
If you are using Notepad++, then there you can search and select "Replace all in all opened documents" will replace it in all files. 如果您使用的是Notepad ++,则可以在其中搜索并选择“替换所有打开的文档中的所有文档”,它将替换所有文件中的文档。 Hopefully it solves your search and replace problem 希望它能解决您的搜索和替换问题
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.