delcomment.sh 以*开头  以//开头 空白行

点击(此处)折叠或打开

  1. /[:*:]/d
  2. /[:/:][:/:]/d
  3. /^$/d

TestMain类

点击(此处)折叠或打开

  1. package test;
  2. /*
  3. *====
  4. *====
  5. **/

  6. public class TestMain
  7. {
  8.         //The main
  9.         public static void main(String []args)
  10.         {
  11.                 System.out.println("The main");
  12.         }
  13. }

[root@localhost sed]# sed -f delcomment.sh TestMain.java 

处理完之后:

点击(此处)折叠或打开

  1. package test;
  2. public class TestMain
  3. {
  4.         public static void main(String []args)
  5.         {
  6.                 System.out.println("The main");
  7.         }
  8. }



09-28 05:02