Aug-26-2021, 01:47 PM
(Aug-25-2021, 08:47 AM)DeaD_EyE Wrote:(Aug-25-2021, 04:18 AM)ndc85430 Wrote: What's the reason for reimplementingzgrep
?
Reimplementing it in Python is better like this:
import subprocess def zgrep(file, pattern): proc = subprocess.Popen(["zgrep", pattern, file], stdout=subprocess.PIPE) for line in proc.stdout: yield line.decode(errors="replace")Code, which utilizeszgrep
, does not run on Windows.
In addition, it adds a dependency to Python + it's not Python.
The next could be, why to implement cat, sort, awk, sed, ... if we already have them on our machines?
The increase of non-pythonic solutions: https://github.com/arunsivaramanneo/GPU-...wer.py#L24
Yes, what could this mean?
Output:Output: python3 ./srch.py path_to_directory matching_text
Have you triedpython3 ./srch.py --help
It's the normal way how command line tools are controlled. They take options, arguments and parameters.
If you want to list a directory on Linux, you could type:ls -l /
The-l
is an option and the/
is an argument and points to the target directory whichls
should show.
I have tried with python3 still same output - Can you please provide complete code to execute from my end?
$ python3 ./srch.py
python3 ./srch.py path_to_directory matching_text