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 196015
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T16:43:53+00:00 2026-05-11T16:43:53+00:00

A popular text editor has the following find in files feature that opens in

  • 0

A popular text editor has the following “find in files” feature that opens in a dialog box:

 Look For:       __searchtext__
 File Filter:    *.txt; *.htm
 Start From:     c:/docs/2009
 Report:         [ ] Filenames [ ]FileCount only
 Method:         [ ] Regex     [ ]Plain Text

In fact, several popular text editors have this.

I would like to do the same thing but using a python or ruby class instead of a text editor.
That way, this same kind of brain-dead simple operation can be run from a script on any platform that supports ruby or python.

Question: I don’t feel like writing this myself, so does anyone know of a ruby or python script that accepts the same or similar easy input args and does what you’d expect?

I am looking for something that does a brute-force linear search, nothing to do with indexed searches.

  • 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-11T16:43:53+00:00Added an answer on May 11, 2026 at 4:43 pm

    I know you said you don’t feel like writing it yourself, but for what it’s worth, it would be very easy using os.walk – you could do something like this:

    results = []
    if regex_search:
        p = re.compile(__searchtext__)
    for dir, subdirs, subfiles in os.walk('c:/docs/2009'):
        for name in fnmatch.filter(subfiles, '*.txt'):
            fn = os.path.join(dir, name)
            with open(fn, 'r') as f:
                if regex_search:
                    results += [(fn,lineno) for lineno, line in enumerate(f) if p.search(line)]
                else:
                    results += [(fn,lineno) for lineno, line in enumerate(f) if line.find(__searchtext__) >= 0]
    

    (that’s Python, btw)

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

Sidebar

Related Questions

Im including the popular file jquery.form.js. I have the following: var options = {
If you look at SharpCrafters , the front page has a cool component that
A popular editor uses highlighting to help programmers avoid using C++ keywords in Java.
I am making changes to my website, and I just noticed that things look
Possible Duplicate: Encrypting/Hashing plain text passwords in database Recently, I discovered that major web
I was wondering that how application like skype ( a popular chat client )
I am looking for a open source Rich Text Editor which supports table, images,
What is the most popular text clustering algorithm which deals with large dimensions and
I am after a general purpose unspecialised plain text file extractor. Firstly before people
I need to get most popular ngrams from text. Ngrams length must be from

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.