简体   繁体   中英

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:

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 $

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.

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.

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.

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. Now for each file do Ctrl+F and replace it.

If you are using Notepad++, then there you can search and select "Replace all in all opened documents" will replace it in all files. Hopefully it solves your search and replace problem

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM