nixCraft Linux Forum

nixCraft

Linux Tech Support Forum

awk - Removing domain name entires

This is a discussion on awk - Removing domain name entires within the Shell scripting forums, part of the Development/Scripting category; Hello, I am new to shell scripting. I want to optimize my one of the script. I have one file ...


Go Back   nixCraft Linux Forum > Development/Scripting > Shell scripting

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 12-18-2007, 11:14 AM
Junior Member
User
 
Join Date: Nov 2007
My distro: RedHat
Posts: 3
nvbhole is on a distinguished road
Default awk - Removing domain name entires

Hello,

I am new to shell scripting. I want to optimize my one of the script.
I have one file and i want to remove selected zones for domains from that file.In this file i have almost 3500 zones for domains.Sample data for the file....

named.backup
-------------------------------------------------------------
zone "britshoponline.co.uk" {
type master;
file "/var/named/britshoponline.co.uk.db";
};

zone "skateboardstickers.net" {
type master;
file "/var/named/skateboardstickers.net.db";
};

zone "kalibrantas.or.id" {
type master;
file "/var/named/kalibrantas.or.id.db";
};

zone "mf-host.com" {
type master;
file "/var/named/mf-host.com.db";
};

zone "googlepatch.com" {
type master;
file "/var/named/googlepatch.com.db";
};
--------------------------------------------------------

list.conf contains 2 records..
vebosoft.com
kalibrantas.or.id

---------------------------------------------------------
AWK script (namedscript.awk) ..
BEGIN{
}

{
zone = $1
sedcmd = "sed '/" zone "/,+4d' named.backup > named.backup.test"
printf "Command: %s\n", sedcmd
system(sedcmd)
system("mv named.backup.test named.backup")
}
END{
}
--------------------------------------------------------------
My command for executing the script:
awk -f namedscript.awk list.conf
--------------------------------------------------------------
In the above code it's possible to remove "system("mv named.backup.test named.backup")" command. But i dont; know i how to do it.

Please help me..
Thanks in Advance
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads

Thread Thread Starter Forum Replies Last Post
Shell Script for adding, removing and commiting the SVN (Subversion system ) anilvrathod Shell scripting 0 12-07-2007 05:40 PM
Masquerade domain sendmail how to chiku Mail Servers 2 07-10-2007 08:20 AM
Removing useless users in CentOS meowing Web servers 3 05-15-2007 12:43 PM
Shell scripting - Removing file extension urbanreformer Shell scripting 3 03-07-2007 08:44 PM
removing a -- directory ricc Linux software 2 06-10-2006 08:40 AM


All times are GMT +5.5. The time now is 05:11 PM.


Powered by vBulletin® Version 3.7.2 - Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35