bshah has asked for the wisdom of the Perl Monks concerning the following question:
Hi Gurus,
I'm looking to iterate a file and if find specific word then store the other lines following that which matches specific pattern.The ldap.txt file is pretty large in several Gigs.
user.txt
test1
game
ldap.txt
dn: uid=test1,ou=people,dc=admin,dc=local
blah
blah
maillocaladdress: test1@example.com
maillocaladdress: test.team@example.com
maillocaladdress: test11@example.com
some date
some more data
data
dn: uid=game,ou=people,dc=admin,dc=local
blah
blah
maillocaladdress: game@example.com
maillocaladdress: game.test@example.com
maillocaladdress: game-test@example.com
some date
some more data
data
and so on..
Open user.txt and iterate through each user and check each line on ldap.txt in dn: line. If matches, then store the value of all the lines matching maillocaladdress to the varialbe , I assume in hash key/value pari but here the values are more than one.
e.g.
test1 matches dn: uid=test1,ou=people,dc=admin,dc=local
Store the following values for each user.
test1@example.com
test.team@example.com
test11@example.com
Thank you for all your help & support.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: File Iteration and looking for specific matching data
by kcott (Archbishop) on Mar 25, 2014 at 06:22 UTC | |
by bshah (Novice) on Mar 26, 2014 at 02:07 UTC | |
by kcott (Archbishop) on Mar 26, 2014 at 05:52 UTC | |
by bshah (Novice) on Mar 30, 2014 at 01:50 UTC | |
|
Re: File Iteration and looking for specific matching data
by Preceptor (Deacon) on Mar 24, 2014 at 21:39 UTC | |
by bshah (Novice) on Mar 24, 2014 at 21:56 UTC | |
|
Re: File Iteration and looking for specific matching data
by Kenosis (Priest) on Mar 24, 2014 at 20:43 UTC | |
|
Re: File Iteration and looking for specific matching data
by choroba (Cardinal) on Mar 25, 2014 at 16:13 UTC |