From: Alistair McKeown (Alistair.Mckeown@jacobsrimell.com)
Date: Mon Jun 06 2005 - 22:21:39 EDT
Hi there,
I have a text file containing continuous streams of the following lines :
cn=200780840,ou=users,ou=budapest,ou=domains,ou=hu,ou=domains,o=chello
uscoLink7=00:00:ca:ba:87:ec
What I need to do is to put it into an ldif format e.g
dn: cn=200780840,ou=users,ou=budapest,ou=domains,ou=hu,ou=domains,o=chello
changeType: modify
delete: uscoLink7
uscoLink7: 00:00:ca:ba:87:ec
I have 152 entries to do, I've tried to make a perl script but its just not
quite right, it doesn't take the uscoLink7 value and the output comes out
like this :
dn:
cn=19300003614560,ou=users,ou=budapest,ou=domains,ou=hu,ou=domains,o=chello
changeType: modify
delete: uscoLink7
uscoLink7:
Here is my perl script below, does anyone know how I can achieve doing this
to get it looking like :
dn: cn=200780840,ou=users,ou=budapest,ou=domains,ou=hu,ou=domains,o=chello
changeType: modify
delete: uscoLink7
uscoLink7: 00:00:ca:ba:87:ec
Perl script
while (<>) # Read line from Infile
{
if ($_ =~ /cn=(.*)/)
{
$cn=$1;
}
if ($_=~ /uscoLink7=(.*)/)
{
$us=$2;
print "dn: cn=$cn\n";
print "changeType: modify\n";
print "delete: uscoLink7\n";
print "uscoLink7: $us\n\n";
}
}
#print "ALL Done, Check OUT file!\n";
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers
This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 23:30:50 EDT