From: Kt Br Date: 2008-05-14T05:28:45+09:00 Subject: modify output of script I've got some LDAP data I'm trying to pipe into a ruby script. Here is an example of the data there are multiple groups (dn) in the real data set. Sometimes the groups (dn) don't have a "seeAlso" or "owner" associated with it: dn: cn=test_group,ou=groups,dc=example,dc=com owner: uid=jsmith,ou=people,dc=example,dc=com seeAlso: uid=bwilliams,ou=people,dc=example,dc=com Here is my script: ---------------------------------------------------------- #!/usr/bin/ruby unless STDIN.tty? while((line = STDIN.gets)) print $1 if /dn: cn=(.*),ou=groups,dc=example,dc=com/ print $1+'@example.com' if /owner: uid=(.*),ou=people,dc=example,dc=com/ print $1+'@example.com' if /seeAlso: uid=(.*),ou=people,dc=example,dc=com/ print "\n" end else end ----------------------------------------------------------- The output of my script: test_group jsmith@example.com bwilliams@example.com What I want the output to look like: test_group jsmith@example.com, bwilliams@example.com Any help would be appreciated. Thanks, Kent -- Posted via http://www.ruby-forum.com/.