Sponsored Content
Top Forums Shell Programming and Scripting sed: find match and delete the line above Post 97718 by zazzybob on Wednesday 1st of February 2006 05:55:01 PM
Old 02-01-2006
Hmm... this should do it
Code:
sed '/^.* {/ {:a /}/ !{N;ba} }; s/.*00:00:00:00:00:00.*//' dhcpd.conf

Cheers
ZB
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Urgent! Sed/Awk Filter Find Pattern Delete Till End Of Line

Hi, I need help with using an awk or sed filter on the below line ALTER TABLE "ACCOUNT" ADD CONSTRAINT "ACCOUNT_PK" PRIMARY KEY ("ACCT_ID") USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 65536 FREELISTS 1 FREELIST GROUPS 1) TABLESPACE "WMC_DATA" LOGGING ENABLE Look for... (2 Replies)
Discussion started by: rajan_san
2 Replies

2. UNIX for Advanced & Expert Users

Urgent Help required : awk/sed help to find pattern and delete till end of line

Hi, I need help with using an awk or sed filter on the below line ALTER TABLE "ACCOUNT" ADD CONSTRAINT "ACCOUNT_PK" PRIMARY KEY ("ACCT_ID") USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 65536 FREELISTS 1 FREELIST GROUPS 1) TABLESPACE "WMC_DATA" LOGGING ENABLE Look for... (1 Reply)
Discussion started by: rajan_san
1 Replies

3. Shell Programming and Scripting

delete a line that does not match the pattern

hi, i am parsing a file, in that searching for lines those contains "$threadNo.Received message:" , if that line contains the required fields write them into a separate file other wise ignore them. i am using the following code,but it is printing all the lines , i dont want to rpint , please help... (3 Replies)
Discussion started by: Satyak
3 Replies

4. Shell Programming and Scripting

sed find matching pattern delete next line

trying to use sed in finding a matching pattern in a file then deleting the next line only .. pattern --> <ad-content> I tried this but it results are not what I wish sed '/<ad-content>/{N;d;}' akv.xml > akv5.xml ex, <Celebrant2First>Mickey</Celebrant2First> <ad-content> Minnie... (2 Replies)
Discussion started by: aveitas
2 Replies

5. Shell Programming and Scripting

sed to find pattern and delete line before and after

I have the following file: line1 line2 MATCH line3 line4 I need to find the pattern, "MATCH" and delete the line before and after MATCH. So the result should be line1 MATCH lline4 I have to use sed because it is the only utility that is common across my environments. I... (1 Reply)
Discussion started by: craftereric
1 Replies

6. Shell Programming and Scripting

Need sed help: find regex and if the next next line is blank, delete both

I've got a report I need to make easier to read Using sh on HP-UX 11.12. In short, I want to search for a regular expression and when found, examine the next line to see if it's blank. If so, then delete both lines. If not blank, move on to the next regexp. Repeat. So far I've got: ... (7 Replies)
Discussion started by: Scottie1954
7 Replies

7. Shell Programming and Scripting

Delete line with match and previous line quoting/escaping problem

Hi folks, I've list of LDAP records in this format: cat cmmac.export.tmp2 dn: deviceId=0a92746a54tbmd34b05758900131136a506,ou=devices,ou=customer,ou=nl,o=upc cmmac: 00:13:11:36:a5:06 dn: deviceId=0a92746a62pbms4662299650015961cfa23,ou=devices,ou=customer,ou=nl,o=upc cmmac:... (4 Replies)
Discussion started by: tomas.polak
4 Replies

8. Shell Programming and Scripting

Sed find exact string and delete line with variable

All, I am trying to read in a variable and search a file then delete based on that string, but i want to match exact word. This works but it matches all, i don't want to match anthing that contains the string, just the exact string. sed -i "/$feedname/d" file I tried sed... (1 Reply)
Discussion started by: markdjones82
1 Replies

9. Shell Programming and Scripting

Delete the last line if match the string

Hi, How to delete the last line if is match the below string else no action... String checking "END OF FILE. ROW COUNT: " 9f680174-cb87-4f71-887a-93b6f62fa5aa|20077337254|2 9f680174-cb87-4f71-887a-93b6f62fa5aa|20077337254|0 229f680174-cb87-4f71-887a-93b6f62fa5aa|20077337254|3 END OF... (2 Replies)
Discussion started by: bmk
2 Replies

10. Shell Programming and Scripting

sed match exactly and delete

I am using following sed rule to delete 2 lines after a pattern match inclusive. # cat /tmp/temp.txt dns.com 11 22 mydns.com 11 22 dns.com.au 11 22 LAST LINE # cat /tmp/temp.txt | sed -e '/dns.com/,+2d' LAST LINE I just need to remove lines below dns.com only and NOT below... (5 Replies)
Discussion started by: anil510
5 Replies
dhcpd.leases(5) 						File Formats Manual						   dhcpd.leases(5)

NAME
dhcpd.leases - DHCP client lease database DESCRIPTION
The Internet Systems Consortium DHCP Server keeps a persistent database of leases that it has assigned. This database is a free-form ASCII file containing a series of lease declarations. Every time a lease is acquired, renewed or released, its new value is recorded at the end of the lease file. So if more than one declaration appears for a given lease, the last one in the file is the current one. When dhcpd is first installed, there is no lease database. However, dhcpd requires that a lease database be present before it will start. To make the initial lease database, just create an empty file called /var/db/dhcpd.leases. You can do this with: touch DBDIR/dhcpd.leases In order to prevent the lease database from growing without bound, the file is rewritten from time to time. First, a temporary lease database is created and all known leases are dumped to it. Then, the old lease database is renamed /var/db/dhcpd.leases~. Finally, the newly written lease database is moved into place. FORMAT
Lease descriptions are stored in a format that is parsed by the same recursive descent parser used to read the dhcpd.conf(5) and dhclient.conf(5) files. Lease files can contain lease declarations, and also group and subgroup declarations, host declarations and failover state declarations. Group, subgroup and host declarations are used to record objects created using the OMAPI protocol. The lease file is a log-structured file - whenever a lease changes, the contents of that lease are written to the end of the file. This means that it is entirely possible and quite reasonable for there to be two or more declarations of the same lease in the lease file at the same time. In that case, the instance of that particular lease that appears last in the file is the one that is in effect. Group, subgroup and host declarations in the lease file are handled in the same manner, except that if any of these objects are deleted, a rubout is written to the lease file. This is just the same declaration, with { deleted; } in the scope of the declaration. When the lease file is rewritten, any such rubouts that can be eliminated are eliminated. It is possible to delete a declaration in the dhcpd.conf file; in this case, the rubout can never be eliminated from the dhcpd.leases file. THE LEASE DECLARATION
lease ip-address { statements... } Each lease declaration includes the single IP address that has been leased to the client. The statements within the braces define the duration of the lease and to whom it is assigned. starts date; ends date; tstp date; tsfp date; The start and end time of a lease are recorded using the starts and ends statements. The tstp statement is specified if the failover pro- tocol is being used, and indicates what time the peer has been told the lease expires. The tsfp statement is also specified if the failover protocol is being used, and indicates the lease expiry time that the peer has acknowledged. The date is specified as follows: weekday year/month/day hour:minute:second The weekday is present to make it easy for a human to tell when a lease expires - it's specified as a number from zero to six, with zero being Sunday. The day of week is ignored on input. The year is specified with the century, so it should generally be four digits except for really long leases. The month is specified as a number starting with 1 for January. The day of the month is likewise specified start- ing with 1. The hour is a number between 0 and 23, the minute a number between 0 and 59, and the second also a number between 0 and 59. Lease times are specified in Coordinated Universal Time (UTC), not in the local time zone. There is probably nowhere in the world where the times recorded on a lease are always the same as wall clock times. On most unix machines, you can display the current time in UTC by typing date -u. If a lease will never expire, date is never instead of an actual date. hardware hardware-type mac-address; The hardware statement records the MAC address of the network interface on which the lease will be used. It is specified as a series of hexadecimal octets, separated by colons. uid client-identifier; The uid statement records the client identifier used by the client to acquire the lease. Clients are not required to send client identi- fiers, and this statement only appears if the client did in fact send one. Client identifiers are normally an ARP type (1 for ethernet) followed by the MAC address, just like in the hardware statement, but this is not required. The client identifier is recorded as a colon-separated hexadecimal list or as a quoted string. If it is recorded as a quoted string and it contains one or more non-printable characters, those characters are represented as octal escapes - a backslash character followed by three octal digits. client-hostname hostname ; Most DHCP clients will send their hostname in the host-name option. If a client sends its hostname in this way, the hostname is recorded on the lease with a client-hostname statement. This is not required by the protocol, however, so many specialized DHCP clients do not send a host-name option. abandoned; The abandoned statement indicates that the DHCP server has abandoned the lease. In that case, the abandoned statement will be used to indicate that the lease should not be reassigned. Please see the dhcpd.conf(5) manual page for information about abandoned leases. binding state state; next binding state state; The binding state statement declares the lease's binding state. When the DHCP server is not configured to use the failover protocol, a lease's binding state will be either active or free. The failover protocol adds some additional transitional states, as well as the backup state, which indicates that the lease is available for allocation by the failover secondary. The next binding state statement indicates what state the lease will move to when the current state expires. The time when the current state expires is specified in the ends statement. option agent.circuit-id string; option agent.remote-id string; The option agent.circuit-id and option agent.remote-id statements are used to record the circuit ID and remote ID options send by the relay agent, if the relay agent uses the relay agent information option. This allows these options to be used consistently in conditional eval- uations even when the client is contacting the server directly rather than through its relay agent. set variable = value; The set statement sets the value of a variable on the lease. For general information on variables, see the dhcp-eval(5) manual page. The ddns-text variable The ddns-text variable is used to record the value of the client's TXT identification record when the interim ddns update style has been used to update the DNS for a particular lease. The ddns-fwd-name variable The ddns-fwd-name variable records the value of the name used in updating the client's A record if a DDNS update has been successfully done by the server. The server may also have used this name to update the client's PTR record. The ddns-client-fqdn variable If the server is configured to use the interim ddns update style, and is also configured to allow clients to update their own fqdns, and the client did in fact update its own fqdn, then the ddns-client-fqdn variable records the name that the client has indicated it is using. This is the name that the server will have used to update the client's PTR record in this case. The ddns-rev-name variable If the server successfully updates the client's PTR record, this variable will record the name that the DHCP server used for the PTR record. The name to which the PTR record points will be either the ddns-fwd-name or the ddns-client-fqdn. on events { statements... } The on statement records a list of statements to execute if a certain event occurs. The possible events that can occur for an active lease are release and expiry. More than one event can be specified - if so, the events are separated by '|' char- acters. THE FAILOVER PEER STATE DECLARATION
The state of any failover peering arrangements is also recorded in the lease file, using the failover peer statement: failover peer name state { my state state at date; peer state state at date; } The states of the peer named name is being recorded. Both the state of the running server (my state) and the other failover partner (peer state) are recorded. The following states are possible: unknown-state, partner-down, normal, communications-interrupted, resolution- interrupted, potential-conflict, recover, recover-done, shutdown, paused, and startup. DBDIR/dhcpd.leases SEE ALSO
dhcpd(8), dhcp-options(5), dhcp-eval(5), dhcpd.conf(5), RFC2132, RFC2131. AUTHOR
dhcpd(8) was written by Ted Lemon under a contract with Vixie Labs. Funding for this project was provided by Internet Systems Consortium. Information about Internet Systems Consortium can be found at: http://www.isc.org/ dhcpd.leases(5)
All times are GMT -4. The time now is 01:47 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy