Skip to content

Commit

Permalink
fix(redis): redis删除key是空格字符异常问题 TencentBlueKing#7815
Browse files Browse the repository at this point in the history
  • Loading branch information
OMG-By authored and iSecloud committed Nov 8, 2024
1 parent 656bad7 commit 71832c0
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,8 @@ func (task *RedisInsKeyPatternTask) getTargetKeysByPartten(db int) {
if grepPattern != "" && grepPattern != ".*" {
grepExtra = fmt.Sprintf(` %s | { grep -vE %q || true; }`, grepExtra, grepPattern)
}
grepCmd := fmt.Sprintf(`awk '{ print $3}' %s %s > %s`, task.KeysFile, grepExtra, task.ResultFile)
grepCmd := fmt.Sprintf(`awk '{for(i=3;i<=NF-3;++i) printf "%%s ", $i; print ""}' %s %s > %s`,
task.KeysFile, grepExtra, task.ResultFile)
_, err := util.RunLocalCmd("bash", []string{"-c", grepCmd}, "", nil, 48*time.Hour)
if err != nil {
task.Err = fmt.Errorf("grepCmd:%s err:%v", grepCmd, err)
Expand Down

0 comments on commit 71832c0

Please sign in to comment.