Sponsored Content
Top Forums UNIX for Beginners Questions & Answers How to search & delete inclusively between two lines? Post 303042155 by chatguy on Monday 16th of December 2019 08:45:19 PM
Old 12-16-2019
Quote:
Originally Posted by MadeInGermany
Code:
awk '$1=="zone" { del=($2~/deletethisentry.com/) } !del' /var/named/zones.conf

If Field#1 is "zone" then set del according to field#2 containing "deletethisentry.com"; print if del is 0.
Thanks everyone above for your help!

And MadeInGermany, thank you so much!!! What you suggested works great!!! I never thought this could be achieved with 1 simple line of awk!!

Thanks again!!
CG
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

search 2 lines and delete above line

Hi, I've been searching in this forum for the last 4 hours trying to do one thing: search 2 lines and delete the above line. So far I have not be able to find something similar in this forum, so I need help. This is what I'm trying to do. For example, I have a file called file1: file1 word1... (4 Replies)
Discussion started by: shamushamu
4 Replies

2. Shell Programming and Scripting

Advanced Search & Delete Text File

I have a file in which email messages are stored in. Every email is separated by by a ^Z character (Control-Z). I need to extract all emails after the 65,00th one to another file and delete them from the original file. Any suggests on accomplishing this? (2 Replies)
Discussion started by: maxcell
2 Replies

3. Shell Programming and Scripting

search a word and delete consecutive lines below it

Hi all coders, I need a help to process some data. I have this file, 3 09/21/08 03:32:07 started undef mino Oracle nmx004.wwdc.numonyx.co m Message Text : The Oracle session with the PID 1103 has a CPU time consuming of 999.00... (3 Replies)
Discussion started by: vikas027
3 Replies

4. Shell Programming and Scripting

Delete new lines based on search criteria

Hi all! A bit of background: I am trying to create a script that formats SQL statements. I have gotten so far as to add new lines based on certain match criteria like commas, keywords etc. In the process, I end up adding newlines where I don't want. For example: substr(colName, 1, 10)... (3 Replies)
Discussion started by: jayarkay
3 Replies

5. Shell Programming and Scripting

awk search & delete located criteria

Guys, I manages to get awk to search and print the files that I want to delete. However I am stuck on the delete portion. Here is the command that I am using to fins these files. find /usr/local/apache/conf/vhosts/ -type f | awk '/e$/' The output is perfect. The files look like so: ... (4 Replies)
Discussion started by: jaysunn
4 Replies

6. UNIX for Dummies Questions & Answers

How get only required lines & delete the rest of the lines in file

Hiiii I have a file which contains huge data as a.dat: PDE 1990 1 9 18 51 28.90 24.7500 95.2800 118.0 6.1 0.0 BURMA event name: 010990D time shift: 7.3000 half duration: 5.0000 latitude: 24.4200 longitude: 94.9500 depth: 129.6000 Mrr: ... (7 Replies)
Discussion started by: reva
7 Replies

7. Shell Programming and Scripting

search and replace, when found, delete multiple lines, add new set of lines?

hey guys, I tried searching but most 'search and replace' questions are related to one liners. Say I have a file to be replaced that has the following: $ cat testing.txt TESTING AAA BBB CCC DDD EEE FFF GGG HHH ENDTESTING This is the input file: (3 Replies)
Discussion started by: DeuceLee
3 Replies

8. Shell Programming and Scripting

search and delete the lines in a file

HI group members I am new in unix I want to search # symbol in a file. if found need to delete the entire row in the file. need to move the actual data(with out # symbol data) to another file. Thanks (2 Replies)
Discussion started by: pmreddy
2 Replies

9. Shell Programming and Scripting

sed search pattern and delete lines

Hello, i have a question. My problem is that i have a file like: TEST JOHN ADAM MICHAEL SEBASTIAN ANDY i want find for MICHAEL and want delete lines like this: TEST (4 Replies)
Discussion started by: eightball
4 Replies

10. Shell Programming and Scripting

SFTP Shell Script Get & Delete && Upload & Delete

Hi All, Do you have any sample script, - auto get file from SFTP remote server and delete file in remove server after downloaded. - only download specify filename - auto upload file from local to SFTP remote server and delete local folder file after uploaded - only upload specify filename ... (3 Replies)
Discussion started by: weesiong
3 Replies
REALMSET(1p)						User Contributed Perl Documentation					      REALMSET(1p)

NAME
realmset - Modifies entries in a DNSSEC-Tools realm file SYNOPSIS
realmset [options] realm-file DESCRIPTION
realmset modifies fields in the realm file specified by realm-file. Multiple options may be combined in a single realmset execution. realmset operates quietly unless it is given the -verbose option. All records in the specified realm file will be modified, unless the -name option is given. In that case, only the named zone will be modified. OPTIONS
-administrator addr The zone administrator's email address is set to addr. -args arglist Provides additional arguments for the realm manager. These arguments will override the arguments in the DNSSEC-Tools defaults file, the DNSSEC-Tools configuration file, and the realms' rollrec files. The manager's argument list is given in arglist. If more than one argument is given, the set of arguments should be enclosed in quotes. Given the realmset argument processing, the new arguments cannot be specified as they would from a command line. Instead, the arguments should be given in the following manner. The leading dash should be replaced with an equals sign. If the option takes an argument, the space that would separate the option from the option's argument should also be replaced by an equals sign. realmset translates these arguments to the appropriate format for the realm manager. These examples should clarify the argument modifications: normal rollerd option -args options ------------------------ --------------- -display =display -logfile /dt/log.file =zskcount=/dt/log.file The following are valid uses of -args: # realmset -args =display example.realm # realmset -args "=loglevel=phase =sleep=3600" example.realm The -args and -del-args options are mutually exclusive. -configdir configdir The directory to hold the realm's configuration files is set to confdir. -del-administrator The administrator line is deleted from the selected realm records. The -administrator and -del-administrator options are mutually exclusive. -del-args The args line is deleted from the selected realm records. The -args and -del-args options are mutually exclusive. -del-display The display line is deleted from the selected realm records. The -display, -nodisplay, and -del-display options are mutually exclusive. -del-manager The manager line is deleted from the selected realm records. The -manager and -del-manager options are mutually exclusive. -del-user The user line is deleted from the selected realm records. The -user and -del-user options are mutually exclusive. -display Turn on the GUI display of the selected realms. The -display, -nodisplay, and -del-display options are mutually exclusive. -manager manager-program The manager program for the selected realms is set to manager-program. -name realmname The realm whose name matches realmname is selected as the only realm that will be modified. If this name is not given, then all realm records will be modified. -newname new-name The realm's name is changed to new-name. The new name cannot be the name of an existing realm in the file. This option must be used in conjunction with the -name option. -nocheck If this option is given, the realmchk command will not be run on the modified realm file. -nodisplay Turn off the GUI display of the selected realms. The -display, -nodisplay, and -del-display options are mutually exclusive. -realmdir realmdir The directory to hold the realm's files is set to realmdir. -rollrec rollrec-file The rollrec file in the selected realm records is modified to be rollrec-file. -state newstate The realm's state is set to newstate. This must be either "active" or "inactive". -statedir statedir The directory to hold the realm's state files is set to statedir. -user username The user name in the selected realm records is modified to be username. -verbose Display information about every modification made to the realm file. -Version Displays the version information for realmset and the DNSSEC-Tools package. -help Display a usage message. COPYRIGHT
Copyright 2012 SPARTA, Inc. All rights reserved. See the COPYING file included with the DNSSEC-Tools package for details. AUTHOR
Wayne Morrison, tewok@tislabs.com SEE ALSO
dtrealms(8), lsrealm(8), realmchk(8), realminit(8) Net::DNS::SEC::Tools::realmmgr.pm(3), Net::DNS::SEC::Tools::realm.pm(3) file-realm(5) perl v5.14.2 2012-06-21 REALMSET(1p)
All times are GMT -4. The time now is 03:58 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy