#!/usr/bin/perl -w # parse the user list dump from nlist into 1 tsv file my @user_list; open (NLIST, $ARGV[0]) or die "Can't open nlist results\n $!"; while () { # do not parse for the exceptions, all else do the following: unless (/^[Object|Current|A total]/) { # user | given | last name? if (/^User\: (\w+)\n/) { push @user_list, { username => lc($1), lastname => "", givenname => ""}; } elsif (/^\tLast Name: (\w+)\n/) { $user_list[-1]->{lastname} = lc $1; } elsif (/^\tGiven Name: (.)+\n/) { $user_list[-1]->{givenname} = $1; } } } close NLIST; for my $user (@user_list) { print "User: $user->{username}\n"; print "\tLast: $user->{lastname}\n"; print "\tGiven: $user->{givenname}\n"; }