系统相关
首页 > 系统相关> > shell – grep on Java Method

shell – grep on Java Method

作者:互联网

假设我有一个名为DirectAction的java

该类中的一些方法有“动作”或“动作”一词

什么是grep命令来获取具有“Action”或“action”的所有方法的名称并将其写入外部文件?

例:

public class DirectAction extends ERXDirectAction {

/**
 * 
 * @param aRequest
 */
public DirectAction(WORequest aRequest) {

}

// ============================================================================================
// ACTIONS

/**
 * Default Action
 * 
 */
@docDirectAction
public WOActionResults defaultAction() {

}

/**
 * @return goes to login page for student
 */
@docDirectAction
public WOActionResults studentAction() {
    );
    return nextPage;
}

/**
 * @return goes to Admin login page
 */
@docDirectAction
public WOActionResults adminAction() {
    return nextPage;
}

/**

 * @return calls the AdminAction
 */
@docDirectAction
public WOActionResults staffAction() {

    return adminAction();
}

}

我想只获得以下输出.

public class DirectAction extends ERXDirectAction

public DirectAction(WORequest aRequest)

public WOActionResults defaultAction()

public WOActionResults studentAction()

public WOActionResults adminAction()

public WOActionResults staffAction()

注意:所有这些方法中唯一常用的词是“动作”或“动作”

另外请尽可能使用grep

标签:java,shell,grep,scripting,shell-script
来源: https://codeday.me/bug/20190816/1664677.html