creating an index of files contents

[email protected] (Sergio Letuche) Fri, 23 Sep 2016 09:48:49 +0300
Newsgroups perl.perl4lib
Message-ID <CANnh_k_0cGpMCx4eJX=GM66yBdzymGeGoH9dex876KOQMs024A@mail.gmail.com>
--001a1142c00ab1af74053d272be7
Content-Type: text/plain; charset=UTF-8

hello community,

Say we have the following structure in our filesystem:

dir1
dir2
dir3
dir4

dir stands for directory of course.

In dir1, there is a file1.txt that has in it numbers, like below

6576576  898798789  5645436549  76567576576  876876876876

Same goes for dir2. In dir2, there is a file2.txt, that has in it numbers,
like below

6576576  89879878963  56454365492  765675765763  8768768768765

And so with all the rest of the folders.
What we need to do, is have a new file (like an index) out of all
directories and files values, like below:

dir1;6576576,898798789,5645436549,76567576576,876876876876
dir2;6576576,89879878963,56454365492,765675765763,8768768768765

And secondly, another index file, which will have the reverse info

6576576;dir1,dir2

Any ideas on how would you approach this?

Best

--001a1142c00ab1af74053d272be7
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail-post-text">

<p>hello community,<br></p><p>Say we have the following structure in our fi=
lesystem:</p>

<pre class=3D"gmail-default gmail-prettyprint gmail-prettyprinted"><code><s=
pan class=3D"gmail-pln">dir1 =20
dir2 =20
dir3 =20
dir4  </span></code></pre>

<p><code>dir</code> stands for directory of course.</p>

<p>In <code>dir1</code>, there is a <code>file1.txt</code>
that has in it numbers, like below </p>

<pre class=3D"gmail-default gmail-prettyprint gmail-prettyprinted"><code><s=
pan class=3D"gmail-lit">6576576</span><span class=3D"gmail-pln"> =20
</span><span class=3D"gmail-lit">898798789</span><span class=3D"gmail-pln">=
 =20
</span><span class=3D"gmail-lit">5645436549</span><span class=3D"gmail-pln"=
> =20
</span><span class=3D"gmail-lit">76567576576</span><span class=3D"gmail-pln=
"> =20
</span><span class=3D"gmail-lit">876876876876</span><span class=3D"gmail-pl=
n"> </span></code></pre>

<p>Same goes for <code>dir2</code>. In <code>dir2</code>, there is a <code>=
file2.txt</code>, that has in it numbers, like below  </p>

<pre class=3D"gmail-default gmail-prettyprint gmail-prettyprinted"><code><s=
pan class=3D"gmail-lit">6576576</span><span class=3D"gmail-pln"> =20
</span><span class=3D"gmail-lit">89879878963</span><span class=3D"gmail-pln=
"> =20
</span><span class=3D"gmail-lit">56454365492</span><span class=3D"gmail-pln=
"> =20
</span><span class=3D"gmail-lit">765675765763</span><span class=3D"gmail-pl=
n"> =20
</span><span class=3D"gmail-lit">8768768768765</span></code></pre>

<p>And so with all the rest of the folders.<br>
What we need to do, is have a new file (like an index) out of all directori=
es and files values, like below:</p>

<pre class=3D"gmail-default gmail-prettyprint gmail-prettyprinted"><code><s=
pan class=3D"gmail-pln">dir1</span><span class=3D"gmail-pun">;</span><span =
class=3D"gmail-lit">6576576</span><span class=3D"gmail-pun">,</span><span c=
lass=3D"gmail-lit">898798789</span><span class=3D"gmail-pun">,</span><span =
class=3D"gmail-lit">5645436549</span><span class=3D"gmail-pun">,</span><spa=
n class=3D"gmail-lit">76567576576</span><span class=3D"gmail-pun">,</span><=
span class=3D"gmail-lit">876876876876</span><span class=3D"gmail-pln"> =20
dir2</span><span class=3D"gmail-pun">;</span><span class=3D"gmail-lit">6576=
576</span><span class=3D"gmail-pun">,</span><span class=3D"gmail-lit">89879=
878963</span><span class=3D"gmail-pun">,</span><span class=3D"gmail-lit">56=
454365492</span><span class=3D"gmail-pun">,</span><span class=3D"gmail-lit"=
>765675765763</span><span class=3D"gmail-pun">,</span><span class=3D"gmail-=
lit">8768768768765</span><span class=3D"gmail-pln">  </span></code></pre>

<p>And secondly, another index file, which will have the reverse info  </p>

<pre class=3D"gmail-default gmail-prettyprint gmail-prettyprinted"><code><s=
pan class=3D"gmail-lit">6576576</span><span class=3D"gmail-pun">;</span><sp=
an class=3D"gmail-pln">dir1</span><span class=3D"gmail-pun">,</span><span c=
lass=3D"gmail-pln">dir2<br><br></span></code></pre><pre class=3D"gmail-defa=
ult gmail-prettyprint gmail-prettyprinted"><code><span class=3D"gmail-pln">=
Any ideas on how would you approach this?<br><br></span></code></pre><pre c=
lass=3D"gmail-default gmail-prettyprint gmail-prettyprinted"><code><span cl=
ass=3D"gmail-pln">Best<br></span></code></pre>
    </div></div>

--001a1142c00ab1af74053d272be7--