How to use zgrep command in python? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to use zgrep command in python?

I have a zgrep command " zgrep -il 'test1.*fi' */files". How do we use regex in python to find this pattern? I have tried using "s= ('^test1.*fi', line)". It is not working for me. Any help would be appreciated. Thanks in advance.

18th Nov 2020, 7:08 AM
perkins royal
perkins royal - avatar
3 Answers
0
zgrep is probably like grep or egrep in bash. Try: zgrep "^test1.*fi
quot; <file_path> (if that doesnt work, just use regular regex my guy) https://www.sololearn.com/learn/JUMP_LINK__&&__Python__&&__JUMP_LINK/2475/
18th Nov 2020, 10:15 AM
Slick
Slick - avatar
0
@slick link is saying profile not found
18th Nov 2020, 4:37 PM
perkins royal
perkins royal - avatar
0
Ahhh must be because you can't skip ahead in lessons. Since you know a bit of python already, just breeze through the lessons up until the regex portion. It may even remind you of a few useful features you haven't used in a while
18th Nov 2020, 4:54 PM
Slick
Slick - avatar