duoan / notes

Classtag's Notebooks
https://github.com/classtag/notebook/issues
9 stars 3 forks source link

recursive grep log #24

Open duoan opened 7 years ago

duoan commented 7 years ago
#!/bin/bash

function scan_dir(){
  for file in `ls $1`
  do
    if [ -d $1"/"$file ]
      then scan_dir $1"/"$file
    else
      # echo $1"/"$file
      gzip -dc $1"/"$file | grep -m 20 '$2' > out.log
    i
  done
}

scan_dir $1 $2

用于递归grep目录下的日志