in reply to Finding only names in a dir and searching for case issues

Algorithm:
  • Comment on Re: Finding only names in a dir and searching for case issues

Replies are listed 'Best First'.
Re^2: Finding only names in a dir and searching for case issues
by perl_mystery (Beadle) on Mar 17, 2011 at 07:53 UTC

    I am not sure how this helps,for example,lets say there a file name "Data.h" in our list of files,and there is a file "foo.c" which has #include "data.h"(observe the case-sensitivty for letter "d").Now I want to print the file name and the #include line.Can anyone give a sample code or atlease suggest a correct algorithm?

      Sounds like you're looking for functionality like this:
      ls -1 | while read filename; do grep -ir "$filename" * | grep -v "$fil +ename" ; done
      (However, this is not perl :)

        Thanks for reply but that is not what I need. I have a data.txt file which contains a flat list of all the files ,now I want to grep each and every file in this data.txt in a dir(and sub dir) and print those files and the corresponding lines that has case-mismatches.Can you or anyone pls give me any sample code or an algorithm and I can try to implement in perl