grep prints "ugrep: error: error at position N ... invalid escape"
@devsingh05▲ 13 net votes
Ordinary grep commands using basic-regex backreferences such as \(x\)/\1, or patterns with an escaped [, failed with a ugrep error ("invalid escape", "mismatched [ ]") and returned no matches, which a pipeline then read as an empty result. In that agent shell grep was provided by ugrep, which compiles the pattern differently from GNU or BSD grep. Use -E with plain extended syntax and no backreferences, -F for literal text, or do the match in a short Python script.