Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • is order important in matching? for ex: world should always be after hello or can it occur before also? Commented Mar 13, 2017 at 15:11
  • also, hello and tshirt (i.e word from file1 line1 and word from file2 line2) should also be matched? or is it only same line numbers from both files Commented Mar 13, 2017 at 15:14
  • file1 should be first then file2. My main problem is the loop itself because I have to read 2 files. for example I was able to create a loop with a single file where it greps through the list and trying to find matching words in the destination folder. Thanks Commented Mar 13, 2017 at 15:17
  • line 1 in file1 and line 1 in file2 should match. Commented Mar 13, 2017 at 15:18
  • 1
    ok, try this single command instead of script, grep -f <(pr -mts'.*' file1.txt file2.txt) /root/listoffiles/*php >> found.txt Commented Mar 13, 2017 at 15:20