hey guys in only new to scripting as such, but i have a problem.
i want to take the output of a search i do in the command line to then be in a variable but only a certain part of the output.
this this what im doing:
-bash-2.05b$ ldapsearch -x '(dn:=dc)' dc|grep dc=
# base <dc=james,dc=morey,dc=home,dc=com> (default) with scope subtree
so "# base <dc=james,dc=morey,dc=home,dc=com> (default) with scope subtree" is what is put out from the command line
now i want to make the "dc=james,dc=morey,dc=home,dc=com" into a variable but just that!!! not the other stuff.
this is so when i create my ldif file it will put it in automatically for you
so instead i will call "dc=james,dc=morey,dc=home,dc=com" some thing like $DC
dc=james,dc=morey,dc=home,dc=com =$DC
my
$stuff= <<LDIF;
dn: uid=$UserName,ou=$OU,ou=$OU2,dc=james,dc=morey,dc=home,dc=com
objectClass: inetOrgPerson
objectClass: organizationalPerson
objectClass: posixAccount
objectClass: shadowAccount
uid: $UserName
cn: $LastName $FirstName
givenName: $GivenName
mail: $UserName\@james.morey.com
sn: $FirstName
uidNumber: $UDI
gidNumber: $UDI
homeDirectory: /home/$UserName
loginShell: /bin/tcsh
userPassword: $b
dn: cn=$UserName,ou=$OU3,ou=$OU2,dc=james,dc=morey,dc=home,dc=comobjectClass: posixGroup
cn: $UserName
gidNumber: $UDI
description: Private group for the \"$UserName\" user"
LDIF
open
MYLDIF, ">", "init.ldif";
print
MYLDIF $stuff;
close
MYLDIF;