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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T22:31:27+00:00 2026-05-15T22:31:27+00:00

I have a series of index files for some data files which basically take

  • 0

I have a series of index files for some data files which basically take the format

index file : asdfg.log.1234.2345.index

data file : asdfg.log

The idea is to do a search of all the index files. If the value XXXX appears in an index file, go and grep its corresponding data file and print out the line in the data file where the value XXXX appears.

So far I can simply search the index files for the value XXXX e.g.

find . -name "*.index" | xargs grep "XXXX"     // Gives me a list of the index files with XXXX in them

How do I take the index file match and then grep its corresponding data file?

  • 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-15T22:31:28+00:00Added an answer on May 15, 2026 at 10:31 pm

    Does this do the trick?

    find . -name '*.index' |
    xargs grep -l "XXXX" |
    sed 's/\.log\.*/.log/' |
    xargs grep "XXXX"
    

    The find command is from your example. The first xargs grep lists just the (index) file names. The sed maps the file names to the data file names. The second xargs grep then scans the data files.

    You might want to insert a sort -u step after the sed step.

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

Sidebar

Related Questions

I have a MySQL table which basically serves as a file index. The primary
I have a series of files on a private ftp file server that I
I have an irregular time series contained in xts and separate time index vector
I have a series of tables which I want to all have an order
I have a series of strings, which are two numbers: 1.782-100.799 -18.107-102.016 -17.504104.059 How
I have a series of ASCII flat files coming in from a mainframe to
http://sandbox.jinoh.dk/magento/index.php/ I am sadly a noob with this system. I have a series of
I have generated a series of rows using C# and VSTO. I have basically
I have an XML file which is structured as follows: <row> <store>place1</store> <location>location1</location> </row>
I have managed to produce a series of three buttons on an index page

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.