Sponsored Content
Top Forums Shell Programming and Scripting Need to delete duplicate lease entry Post 302399045 by dennis.jacob on Friday 26th of February 2010 06:01:34 AM
Old 02-26-2010
No easy way..try something like

Code:
awk '/^lease/ && !A[$2]++ { f=1; } f++<=10 { print >"outfile" }' file
mv outfile file

 

10 More Discussions You Might Find Interesting

1. HP-UX

Hazardous Duplicate Cron Entry?

Hi All, How to prevent starting of processes that have duplicate entries in cron file, i have written a shell script to validate with "ps |grep" command before starting the process, but still when same process started at same time, it may not be able to detect the existing process. Sample... (3 Replies)
Discussion started by: nag_sundaram
3 Replies

2. UNIX for Dummies Questions & Answers

Remove duplicate entry in one line

Can anyone help me how can i print only the unique entry in a line? MI_AP MI_AP MI_CM MI_MF RC_NAP MBS_AP SF_RAN MBS_AP NT_CAR so that it will on output the one unique entry per line. MI_AP MI_CM MI_MF RC_NAP MBS_AP SF_RAN NT_CAR I can't find the same situation on the knowledge... (5 Replies)
Discussion started by: kharen11
5 Replies

3. Shell Programming and Scripting

delete entry from /etc/hosts file ?

Hi there I have a requirement where i have to globally remove a hosts file entry from all boxes e.g. 10.01.10.1 my_server1 normally for 'in-line' editing of files without passing it out to another fle and copying it back etc which is messy, Ive been using the fantastic "perl -pi... (1 Reply)
Discussion started by: hcclnoodles
1 Replies

4. Shell Programming and Scripting

Print Only second Duplicate entry in the file

I have file where it contains 2 columns. In two columns the first column is repeated more than once. I wanted to take the unique record in first column and the corresponding second column value . The below is the example of the file: 8244100320012955|000b063471a4... (4 Replies)
Discussion started by: ravi_rn
4 Replies

5. UNIX for Dummies Questions & Answers

Compare these two lines and delete the old entry

I have a unique situation here which looks easier at first but I am not able to solve it. # SSort UNIX 10/14/2005 10/13/2010 "tox" "9000/800" 16 * * * V849-6-1 # SSort UNIX 11/31/1996 11/02/2010 "tox" "9000/800" 16 * * * W237-S-2 I have a text file with two or multiple values like this and... (1 Reply)
Discussion started by: pareshan
1 Replies

6. Shell Programming and Scripting

checking duplicate entry in file

Hi i have a file like 110.10 120.10 -1120 110.10 and the lines are having more than 10k. do we have anycommand to check the duplicate entries in the file. I applied the while loop by greping each line with whole file, but it is taking huge amount of time as the file size is large. ... (5 Replies)
Discussion started by: saluja.deepak
5 Replies

7. UNIX for Dummies Questions & Answers

remove duplicate entries from dhcp.lease

Hi, I have to parse the dhcp.lease file and have to keep the most recent entry and remove the rest and also the number of lines between any two leases might not always be the same. eg: lease 5.5.5.252 { starts Wed Jul 27 09:48:39 2011 ends Wed Jul 27 21:48:39 2011 tstp Wed Jul... (1 Reply)
Discussion started by: bitspradp
1 Replies

8. Shell Programming and Scripting

Deleting duplicate glosses in a dictionary entry

I am working on an Urdu to Hindi dictionary and I have created the following file structure: Headword=Gloss1,Gloss2,Gloss3 i.e. glosses delimited by a comma. It so happens that in some cases (around 6000+ in a file of over 200,000+ the glosses are duplicated. Since this may be a... (3 Replies)
Discussion started by: gimley
3 Replies

9. How to Post in the The UNIX and Linux Forums

Help me, write a bash script to delete parent entry with all their child entry in LDAP UNIX server

Hi All, Please help me and guide me to write a bash/shell script on Linux box to delete parent entry with all their child entries. example: Parent is : ---------- dn: email=yogesh.kumar@wipro.com, o=wipro, o=in child is: ---------- dn: cn: yogesh kumar, email=yogesh.kumar@wipro.com,... (1 Reply)
Discussion started by: Chand
1 Replies

10. Shell Programming and Scripting

Find duplicate values in specific column and delete all the duplicate values

Dear folks I have a map file of around 54K lines and some of the values in the second column have the same value and I want to find them and delete all of the same values. I looked over duplicate commands but my case is not to keep one of the duplicate values. I want to remove all of the same... (4 Replies)
Discussion started by: sajmar
4 Replies
jdbmod(8)						      System Manager's Manual							 jdbmod(8)

NAME
jdbmod - Adds, modifies, or deletes data in the DHCP dynamic databases. SYNOPSIS
/usr/sbin/jdbmod [-d] [-e] [-f character] [-i] [-l | -n] [-o] [-w] filename... OPTIONS
Loads the data of a particular record even though the lease has expired. The default is not to load such records. Use this option with care; the server may have released the expired addresses to a new client since the data was dumped. Deletes the records whose keys are implied by the input file(s). The key fields are the hardware type and address and the subnet containing the IP address. Uses character as the field separator. The default is the pipe (|) character. Allows an existing IP address assignment to be overridden. By default, an attempt to assign an IP address will fail if that address already exists and is bound to a different client. This differs from the -w option, which controls whether a pre-existing MAC-address/client-id pairing may be updated. Loads lease information only. Do not load names. The default is to load both. Loads name information only. Loads only records owned by this server. Allows existing records to be overwritten. The default mode is to forbid the update if the record already exists in the database. The jbdmod command keys its data entry from the MAC address and subnet IP address tuple replacing the record in overwrite mode if it already exists, or adding the record if not. It also checks whether the IP address has already been taken by another client. DESCRIPTION
The jdbmod command modifies the databases used by joind to store information on client IP address leases and dynamic names. The jdbmod com- mand allows the user to load preassigned hardware-IP address combinations for those clients requiring infinite leases. Each record to be loaded is terminated by a newline, and the fields within each record delimited by default with the pipe (|) character, although this may be changed with the -f command line option. Date fields may be expressed either in Universal Coordinated Time (UCT), which is the number of seconds since 00:00 01/01/1970 GMT, or in a variety of formats more easily understood by liveware (for example, Mon Jan 09 1995 10:00 and 01/09/1995 10:00:00). The fields within the data file(s) to be loaded are as follows: This is the identifier which uniquely identifies the client. It may be the client's MAC address or an opaque object, uninterpreted by the JOIN software. If non-zero, then the client id is the MAC address of the client corresponding to this type. If zero, then the client id may be any byte array which serves uniquely to identify the client. The length of the identifier in 8-bit bytes. Note that if the client id corresponds to a MAC address then the value of this field must be con- sistent with the length implied by client id type. But in the more general case, it may be needed in order to determine whether the client id is to be interpreted as a literal or as a decimal or hexadecimal encoding of a byte string. The IP address assigned to the client. If this value is null or 0.0.0.0 it means "none". This is possible if jdbmod is being used to load client id/name combinations in advance of the client being bound to a specific IP address. This has the effect of reserving a name as belonging to that client. The time at which this lease began. A value of zero (or null) is taken to mean now. The time at which this lease will expire. A negative value is taken to mean no expiration. This is stored in the database as the maximum positive signed 32 bit value which translates to Jan 18 19:14:07 2038. The time at which this lease may be renewed. Requests to renew the lease prior to this will be answered by a reply determined by the resid- ual time remaining on the lease until expiration. After this time has passed, the client will receive an entirely new lease whose duration is determined by the bootptab database. Time when the client last acquired or renewed this lease. Unless this value is known from an invocation of jdbdump it is best to set it to -1 or null, which has the conventional significance of now. IP address of server "owning" the lease. If this value is null or 0.0.0.0 it means that the lease will become owned by this server. The client's name (without the domain name). This name must obey the rules set forth in RFC952 as amended by RFC1123. It must be accompanied by a valid domain and it is converted to lowercase before being stored in the database. The client's domain (without the leaf name). This domain must obey the rules set forth in RFC952 as amended by RFC1123 and it must not have any trailing period. The name domain combination is stored in the database as a single entity after being converted to lowercase. NOTES
The jdbmod command loads name-address bindings into the JOIN databases. It does not modify existing name services (NIS, NIS+, or BIND/DNS). The intent is exactly contrary; the name and address bindings should have been determined from an authoritative source, either the name service in use or a previous backup of the database made by jdbdump. The JOIN database does not permit a client, as identified by the client id field, to have a lease on more than one IP address on the same network. But, a client is permitted to have leases on IP addresses on different networks. If you attempt to load a lease binding a client to an IP address, jdbmod first checks that the client holds no other outstanding lease on the same network. If it does, the binding is rejected. The -w option allows this behavior to be overridden. The binding of the old IP address to the client is dissolved and is replaced by the new binding. The behavior of the -i option is different. An attempt to bind an IP address to a client is forbidden if the address is already bound to a different client. The -i option explicitly permits this behavior, dissolving the binding of the old IP address and rebinding to the new client. In the most general case, if you are sure that the data you are loading is authoritative, both options are needed. RESTRICTIONS
Because the database used by join does not support multiuser concurrency, applications that write to it lock the entire database. This means that you cannot use the jdbmod command while the joind daemon is running. The converse is also true. The jdbmod command keys its data entry from the MAC address/ subnet IP address tuple, replacing the record in overwrite mode if it already exists, or adding the record if it does not. However, it does not check whether the resulting IP address has already been taken by another client. Before loading a file, you must ensure that no IP address conflicts exist either internal to the file itself or to the existing database. FILES
SEE ALSO
Commands: jdbdump(8), joind(8) Files: bootptab(4) jdbmod(8)
All times are GMT -4. The time now is 02:44 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy