awk/sed in python?

Can do the following command in Python

 awk '{print $1,$2}' | cut -f1 -d'.' " "| sed '1d' | sed /^-/d | sed '/_/!d' | sed 's/ /:/g' | uniq
LVL 2
SiHodgy007Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

David FavorLinux/LXD/WordPress/Hosting SavantCommented:
Python. PERL. Ruby. Lang-of-your-choice.

They're all the same.

So you can do the above in any language.

PERL provides much easier built in tech for converting awk + sed.

Python will require a bit more coding, as follows...

1) open your file or STDIN

2) loop through all records

3) Duplicate your pipeline by splitting your records on \s+ (awk + cut) then doing regular expression edits (sed)

4) print output to STDOUT

Very simple/common coding.

You might open a Gig + hire several people to provide various solutions.

You can learn a lot from long time coder's code implementations.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
David FavorLinux/LXD/WordPress/Hosting SavantCommented:
Poster has stopped posting.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Python

From novice to tech pro — start learning today.