Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 621843
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T18:55:11+00:00 2026-05-13T18:55:11+00:00

Has anyone written the GNU cat command in python and would be willing to

  • 0

Has anyone written the GNU cat command in python and would be willing to share? GNU cat actually does quite a bit & I don’t really feel like re-inventing the wheel today. Yes, I did do a google search & and after reading too many sad stories of kittens vs snakes I decided to try SO.

Edit: I’d like to modify it so that it only shows unique lines.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T18:55:12+00:00Added an answer on May 13, 2026 at 6:55 pm

    That depends which functionalities you want. If you just want to print out a file, you can do

    with open('myfile') as f:
        for line in f:
            print line,
    

    or to concatenate some files, you could do

    filenames = ['file1', 'file2', 'file3']
    for filename in filenames:
        with open(filename) as f:
            for line in f:
                print line,
    

    There is no general answer. Depending on the functionality you want to replicate, your code will be different. To exactly replicate something odd and special, use the subprocess module and call cat.

    If you want to implement the same interface as cat, that seems an odd requirement. You can call cat and you can write the code more naturally. The only reason I can think to completely reimplement cat is for homework, and I would hope you wouldn’t ask for the finished product if that is your reason.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Has anyone written some interesting or cool Linq extension methods they would like to
Has anyone written a nice extension method 'library' for System.Drawing.Color. Would be nice to
Has anyone written any tutorials or have any documentation on how to use GnuPGME
Has anyone written a macro that will remove and sort your usings in an
Has anyone written XACML Implementations other than the Sun XACML Implementation and XEngine? Who
Has anyone written either a long or short program in COW that demonstrates what
Has anyone written a Fast Algorithm that generates a LARGE dummy file in PHP,
Has anyone written a fast Fourier transform extension for R that modifies R's native
This may be Compass 101, but has anyone written a mixin which sets the
Has anyone written, or know of a query, that will find and drop all

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.