github.com/aergoio/aergo@v1.3.1/consensus/impl/raftv2/test/do_sed.sh (about)

     1  #!/usr/bin/env bash
     2  
     3  if [ "$#" != "4" ];then
     4  	echo "Usage: $0 filepattern input_pat output_pat separator"
     5  	exit 100
     6  fi
     7  
     8  rm -rf *.sedtmp
     9  
    10  pattern=$1
    11  input=$2
    12  output=$3
    13  separator=$4
    14  
    15  echo "pattern=$pattern"
    16  
    17  for file in $(ls *$pattern*); do
    18  	echo $file
    19  
    20  	tmpfile=$file.sedtmp
    21  #	echo "sed s${separator}${input}${separator}$output${separator}g $file > $tmpfile"
    22  
    23  	sed -e "s${separator}${input}${separator}$output${separator}g" $file > $tmpfile
    24  	mv $tmpfile $file
    25  done
    26