[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [K12OSN] ldap problems fixed/need help with ldif script

well, unfortunately, I wrote a shell script which read in each line, and did 7 if then, elif's

way more complicated than it had to be....
I wihs I had read this first...

someone on our lug list also mentioned that grep takes the -v,
cat backup.ldif|grep -v structuralObjectClass|grep -v entryUUID|

that would output everything but those lines.

Carlos Hanson wrote:

so, now we are stuck with a backup.ldif of users, that is full of the

structuralObjectClass: inetOrgPerson
entryUUID: 6610afe4-0483-1027-9a9c-94a42655b8a5
entryCSN: 2003051416:53:37Z#0x0001#0#0000

entries.....does anyone have a script, or know of an easy way to look for any lines starting with:

and just delete them...?
then we can use the ldapadd command above, and get our database squared away...

Here are a couple possibilities using sed or awk:

cat backup.ldif |
sed -e /^structuralObjectClass/d -e /^entryUUID/d -e /^entryCSN/d

cat backup.ldif |
awk '{
 if ($0 !~ /^structuralObjectClass|^entryUUID|^entryCSN/)

K12OSN mailing list
K12OSN redhat com
For more info see <http://www.k12os.org>

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]