templatedaa.blogg.se

Python subprocess pipe
Python subprocess pipe













python subprocess pipe

Python - while wordier than awk - is also explicit where awk has certain implicit rules that are opaque to newbies, and confusing to non-specialists.Īwk (like the shell script itself) adds Yet Another Programming language.

python subprocess pipe

The simplicity of "Python to sort" processing (instead of "Python to awk to sort") prevents the exact kind of questions being asked here. With sort, it rarely helps because sort is not a once-through filter. A quick measurement of awk >file sort file and awk | sort will reveal of concurrency helps. For short sets of data, it has no significant benefit.

python subprocess pipe

The pipelining from awk to sort, for large sets of data, may improve elapsed processing time. There's nothing unique about awk's processing that Python doesn't handle. Some of the reasons for suggesting that awk isn't helping.Īwk is adding a step of no significant value. You'd be a lot happier rewriting 'script.awk' into Python, eliminating awk and the pipeline.Įdit. Let it connect two processes with a pipeline. import subprocessĪwk_sort = subprocess.Popen( "awk -f script.awk | sort > outfile.txt",ĭelegate part of the work to the shell. You'd be a little happier with the following.















Python subprocess pipe