Eshan_k has asked for the wisdom of the Perl Monks concerning the following question:

Hello Monks, I am new to perl scripting. I have to complete a task. I have given a directory I and in that directory has 130 sub directories. From those directories has report sub- directory and from reports there is one .txt file I want to grab pattern from that file. Similarly. I have to do it for all and get the pattern. Can anyone please help. How to do that? Any help will be greatly appreciated.
  • Comment on Reading Directory and getting pattern from a file

Replies are listed 'Best First'.
Re: Reading Directory and getting pattern from a file
by Anonymous Monk on Feb 10, 2015 at 03:40 UTC
Re: Reading Directory and getting pattern from a file
by GotToBTru (Prior) on Feb 10, 2015 at 17:12 UTC
    ~/directory /subdir1 /report file.txt /subdir2 /report anotherfile.txt ... /subdir130 /report yetanotherfile.txt

    Is this a correct idea of the files and directory structure? File::Find, as suggested, will navigate among the subdirectories. No idea what you mean by "grab a pattern".

    If this is homework, it's best to say so up front.

    Dum Spiro Spero
      Hello Dum Spiro Spero, The structure you showed is correct. I know how to get pattern string from that file. To be honest it is related to my work and I got stuck at point. Can you please show a sample code. I would really appreciate your help. Again thanks for replying to my post.

        What do you have so far? Look at the examples provided with File::Find, and you can find others via Google and on this site.

        By the way, "Dum Spiro Spero" is not my name, just a tagline. It means "while I breathe, I hope" in Latin.

        Dum Spiro Spero