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 committed Nov 7, 2024
1 parent 4912c21 commit 60b9557
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 60b9557

Please sign in to comment.