zoukankan      html  css  js  c++  java
  • grep piple & file

    please notice that the string appended to grep command should be piple or file name, should not be just a string.

    of course you can exploit the temp file for your resolution as possible as you can.

    dos copy --> right click

    Below is an example:

     1 #!/bin/bash
     2 
     3 #----------------------------------------------------------------
     4 # This script is used to extract the methods of the java class
     5 #-----------------------------------------------------------------
     6 cat java.java | while read line
     7 do
     8  #echo $line > temp.txt
     9  #grep "public class" temp.txt >> result.txt
    10  #grep "public.*{" temp.txt >> result.txt
    11  #grep "private.*{" temp.txt >> result.txt
    12  #rm temp.txt
    13  
    14  if [[ -n `echo $line | grep "public class"` ]]
    15  then 
    16      echo $line >> result.txt
    17  elif [[ -n `echo $line | grep "public.*{"` ]]
    18  then
    19      echo $line >> result.txt
    20  elif [[ -n `echo $line | grep "private.*{"` ]]
    21  then
    22   echo $line >> result.txt
    23  else
    24   echo hello
    25   continue
    26  fi
    27 done
  • 相关阅读:
    使用binlog恢复数据
    Xtrabackup增量差量备份
    解压腾讯DB冷备的xb文件
    mysqldump
    xtrabackup备份选项
    MySQL的各种日志
    MySQL的事务相关概念
    LVS(dr)+keepalived
    MeasureSpec学习
    网络通信机制:Socket、TCP/IP、HTTP
  • 原文地址:https://www.cnblogs.com/kelin1314/p/1964056.html
Copyright © 2011-2022 走看看