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?