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.
In reply to File Iteration and looking for specific matching data by bshah
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |