Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Given the following Unix pipelines, write Python scripts (ie. translateX.py) that accomplishes the same task. translate1.py: grep -Po ':1d*0:' /etc/passwd | wc -l translate2.py: /bin/ls

Given the following Unix pipelines, write Python scripts (ie. translateX.py) that accomplishes the same task.

translate1.py: grep -Po ':1\d*0:' /etc/passwd | wc -l

translate2.py: /bin/ls -ld /etc/* | awk '{print $4}' | sort | uniq

translate3.py: curl -sLk http://yld.me/raw/fDIO | cut -d , -f 4 | grep -Eo '^M.*' | sort

translate4.py: cat /etc/passwd | cut -d : -f 7 | sort | uniq -c | sort -srn

Notes

No credit will be given for simply calling os.system or os.popen on the given pipeline.

You may use os.popen to read the output of a single command, but not for a pipeline.

Use functional programming, list comprehensions, or generator expressions whenever possible.

You do not need to do a literal translation (that is you don't have to replicate each portion of the pipeline); you just need to accomplish the same overall task and emit the same output.

Most of the scripts should only be 5 - 10 lines long.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David Kroenke, David Auer, Scott Vandenberg, Robert Yoder

9th Edition

0135188148, 978-0135188149, 9781642087611

More Books

Students also viewed these Databases questions