Reg python regexp
It seems for me that this task does not need both python AND shell. Only
python does it, as well as only shell.
Of course, there can be some restrictions let you use both. (the real world
is filled up with such troublesome matters !)
If you *really* need to use `lgrep`, try `-f` option.
`lgrep -f` uses pattern as just a fixed text, not regexp.
2018?3?21?(?) 20:35 Rhodri James <rhodri at kynesim.co.uk>:
> On 21/03/18 10:44, sankarramanv at gmail.com wrote:
> > Hi,
> > I have a requirement.
> > cmd="cat <file>|grep -c 'if [ -t 1 ]; then mesg n 2>/dev/null; fi'"
> > I need to escape only the square brackets in above variable since its
> not grepping without escaping the brackets.
> You need to escape the square brackets as you normally would for your
> shell, with backslashes I presume. Then you need to escape the
> backslashes so they aren't interpreted specially by Python, with more
> Rhodri James *-* Kynesim Ltd