ldapsearch -x "(mail=*)" mail | grep "mail.*@" | perl -n -l -F. -e 's/mail:\s//g; {print lc($_) if $_ =~ /.*\..*@/}' | less
my (@arr) = $_ =~ /(.+)\.(.+)\@(.+)/; if (@arr) { print $arr[-3] }
ldapsearch -x "(mail=*)" mail | grep "mail.*@" | perl -n -l -F. -e 's/mail:\s//g; {my (@arr) = $_ =~ /(.+)\.(.+)\@(.+)/; if (@arr) { print $arr[-3] } if $_ =~ /.*\..*@/}' | less
ls | grep "test" | sort
1
2
3
4
5
6
7
8
9
ldapsearch -x "(mail=*)" mail | grep "mail.*@" | perl -n -l -F. -e '
s/mail:\s//g;
{
my (@arr) = $_ =~ /(.+)\.(.+)\@(.+)/;
if (@arr) {
print $arr[-3]
} if $_ =~ /.*\..*@/
}
' | less
@arr = split /\@/; unshift @arr,$_ for reverse split /\./,shift @arr;