Reg python regexp

sankarramanv at gmail.com sankarramanv at gmail.com
Wed Mar 21 06:44:48 EDT 2018


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.

Please help.

Thanks.



More information about the Python-list mailing list