I have an directory file and there are so many files inside the directory. I want to pass the string from one class to another and get the result.
main for the directory file
class file name declared with main
input files in the Directory templates are 1.txt
here i would like to make an pattern matching. if the directory file matches with 1.txt it should print the contents inside 1.txt.so for that i want to pass the file names to the Dircheck1 and get the result. The file name called here and stored in name text in the pattern matcher.
So i want to pass the file names from one to another and get the result. I hope i am clear in explaining. Guide me how to reach the desired output.
I can see that all your threads are related but I can't with any certainty really see how. My current understanding is that you have a set of files (the object files) that contain key words that need to be replaced by another word/value. The replacement values seem to be defined in another set of files ( the key definition files). I don't see how this relates to the title of this thread but ...
It seems to me that you need to read the replacement word/values for the files and build a (old value, new value) map. You then need to read ( a line at a time ) each of the files containing the targets to be replaced and then for each line read replace all the words in these lines if they match the key words in the map.
If this is the case then you seem to need to -
a) generate the (old value, new value) map from the key definition files.
b) for each file the object file set
define a file to write the result into,
read each line of the object file,
for each line replace all words that have matching entries in the map
write the modified line to the result file.
I can think of many many ways to implement the replacement part but much depends on how many key values there are.