Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Deletion of list of user based on a text file In LDAP UNIX server Post 302960735 by zaxxon on Thursday 19th of November 2015 04:54:59 AM
Old 11-19-2015
Please use code tags in future when posting commands, logs, data etc. I have changed this in your post already.

You might want to use a loop like a while/read around the command ldapdelete and feed it with that list.
Though to be better safe than sorry you will have a small list of users to delete (let's say 3 of them), instead of all 15.000.

Here you can find the syntax: The ldapsearch, ldapdelete and ldapmodify utilities

It will basically look like this, where you have to change the list and the echo to ldapdelete with the correct command switches etc.:
Code:
$ cat infile
will
martha
pete
$ while read LINE; do echo $LINE; done < infile
will
martha
pete

 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

File deletion when server restarts

Hi, In a shell script I am makin use of 3 files f1,f2 and f3.txt. When the Unix server is restarted I want to delete all these 3 files if they are existing. ( I suppose I will have to use this command rm /thefilepath/f* but dont know in which script to use.) Anyone knows what can be... (6 Replies)
Discussion started by: k_oops9
6 Replies

2. Solaris

Script for automatic deletion of trash file of mail server

Hi, I have a mail server with limited space and operating system is sun solaris 8 (sparc). I do not have provisions to increase the space for home directory. So i have to delete files from /home/username/mail/trash which are more than 10 days old automatically. So my script should be like... (1 Reply)
Discussion started by: crown2100bd
1 Replies

3. Shell Programming and Scripting

Deletion of lines in a text file

Hi Everyone, Please help me with this. I have gone through many posts here but couldn't find what I wanted. I have a file with 79000+ lines and I want to delete lines in a pattern. I want to delete every 141st line in the file, starting from line 2000 till 50000. Please help guys. ... (8 Replies)
Discussion started by: max29583
8 Replies

4. Shell Programming and Scripting

Delete block of text in one file based on list in another file

Hi all I currently use the following in shell. #!/bin/sh while read LINE do perl -i -ne "$/ = ''; print if !m'Using archive: ${LINE}'ms;" "datafile" done < "listfile" NOTE the single quote delimiters in the expression. It's highly likely the 'LINE' may very well have characters in it... (3 Replies)
Discussion started by: Festus Hagen
3 Replies

5. Shell Programming and Scripting

Unix ldapsearch can not contact a Windows LDAP Server

Good morning, Firstly my appologies if this post is not exactly approprate for this forum but I do not know were else to post it. If anyone knows of a better forum for this please let me know. I need to script an ldapsearch that will interrogate both unix and windows ldap servers. When it... (1 Reply)
Discussion started by: twk
1 Replies

6. UNIX for Dummies Questions & Answers

Script for replacing text in a file based on list

Hi All, I am fairly new to the world of Unix, and I am looking for a way to replace a line of text in a file with a delimited array of values. I have an aliases file that is currently in use on our mail server that we are migrating off of. Until the migration is complete, the server must stay... (8 Replies)
Discussion started by: phoenixjc
8 Replies

7. Shell Programming and Scripting

Write a scripts to kill idle user for 60 min. & email user list to admin in text file

Folks, I have written one script for following condition by referring some of online post in this forum. Please correct it if I'm missing something in it. (OS: AIX 5.3) List the idle user. (I used whoidle command to list first 15 user and get username, idle time, pid and login time).... (4 Replies)
Discussion started by: sumit30
4 Replies

8. UNIX for Dummies Questions & Answers

print multiple lines from text file based on pattern list

I have a text file with a list of items/patterns: ConsensusfromCGX_alldays_trimmedcollapsedfilteredreadscontiglist(229095contigs)contig12238 ConsensusfromCGX_alldays_trimmedcollapsedfilteredreadscontiglist(229095contigs)contig34624... (1 Reply)
Discussion started by: Oyster
1 Replies

9. UNIX and Linux Applications

User Based LDAP Client Access

Hi everyone, I am not that familiar with LDAP advanced contents. But since it is a popular secure tool for authentication, I preferred to user RedHat LDAP. The organization has 5 organizational units. There are 3 client servers and I want to limit each client to access different users. So, I... (3 Replies)
Discussion started by: royalliege
3 Replies
Net::LDAP::Search(3)					User Contributed Perl Documentation				      Net::LDAP::Search(3)

NAME
Net::LDAP::Search - Object returned by Net::LDAP search method SYNOPSIS
use Net::LDAP; $mesg = $ldap->search( @search_args ); @entries = $mesg->entries; DESCRIPTION
A Net::LDAP::Search object is returned from the search method of a Net::LDAP object. It is a container object which holds the results of the search. METHODS
Net::LDAP::Search inherits from Net::LDAP::Message, and so supports all methods defined in Net::LDAP::Message. as_struct ( ) Returns a reference to a HASH, where the keys are the DNs of the results and the values are HASH references. These second level HASHes hold the attributes such that the keys are the attribute names, in lowercase, and the values are references to an ARRAY holding the values. This method will block until the whole search request has finished. count ( ) Returns the number of entries returned by the server. This method will block until the whole search request has finished. entry ( INDEX ) Return the N'th entry (zero-based), which will be a Net::LDAP::Entry object. If INDEX is greater or equal than the total number of entries returned then "undef" will be returned. This method will block until the search request has returned enough entries. entries ( ) Return an array of Net::LDAP::Entry objects that were returned from the server. This method will block until the whole search request has finished. pop_entry ( ) Pop an entry from the internal list of Net::LDAP::Entry objects for this search. If there are no more entries then "undef" is returned. This call will block if the list is empty, until the server returns another entry. references ( ) Return a list of references that the server returned. This will be a list of Net::LDAP::Reference objects. sorted ( ) Return a list Net::LDAP::Entry objects, sorted by their DNs. The sorting is done on the client side using Perl's alphanumerical sort operator "cmp". sorted ( ATTR, ... ) Return a list of Net::LDAP::Entry objects, sorted by the specified attributes. The attributes are compared in the order specified, each only being compared if all the prior attributes compare equal. The sorting is done on the client side using Perl's alphanumerical sort operator "cmp". shift_entry ( ) Shift an entry from the internal list of Net::LDAP::Entry objects for this search. If there are no more entries then "undef" is returned. This call will block if the list is empty, until the server returns another entry. SEE ALSO
Net::LDAP, Net::LDAP::Message, Net::LDAP::Entry, Net::LDAP::Reference ACKNOWLEDGEMENTS
This document is based on a document originally written by Russell Fulton <r.fulton@auckland.ac.nz>. AUTHOR
Graham Barr <gbarr@pobox.com> Please report any bugs, or post any suggestions, to the perl-ldap mailing list <perl-ldap@perl.org>. COPYRIGHT
Copyright (c) 1997-2004 Graham Barr. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.18.2 2013-07-21 Net::LDAP::Search(3)
All times are GMT -4. The time now is 09:45 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy