• Status: Solved
  • Priority: Low
  • Security: Public
  • Views: 66
  • Last Modified:

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
  • 2
1 Solution
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.
David FavorLinux/LXD/WordPress/Hosting SavantCommented:
Poster has stopped posting.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now