Search and Destroy Script Direction Help


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Search and Destroy Script Direction Help
# 8  
Old 03-07-2014
Been attempting to figure this out myself (so I can learn) but I can not figure out how to alter the script RudiC created to delete instead of print contents to a text file. Everytime I test the print to .txt file it works great.

I have also tried doing the following one liner that isn't working either.
Code:
cat domains.txt | while read Z; do sed -e "/^zone \"${Z}\"/,/^};/d" named.conf.tmp > named.conf.out; done cp -p named.conf.out named.conf.tmp;  done

I think my way isn't as nice as RudiC way so I am going back to trying to figure out how to change it to delete those entries.

Any help would be great. (Hints even)
# 9  
Old 03-07-2014
Using awk you cannot modify the file on the fly. Just redirect the output to another file.
Code:
awk '...' domain.txt file > new.conf

The new.conf will have everything except the domain entries you wanted to delete. And then you can rename this file to whatever you want.

HTH

--ahamed
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

How to destroy corrupt zpool without importing it?

A couple of spare disks have been added to a Solaris 10 system, and one of them has a corrupt zpool on it. I don't care about the data: I want to destroy it and re-use the disk, but it's corrupt so I can't import it. The corrupt pool is called "rpool" so I don't want to destroy it by name... (2 Replies)
Discussion started by: Mysturji
2 Replies

2. What is on Your Mind?

How to destroy one's business...?

I don't know enough about this subject but this is for the big guns... Yesterday:- Man accidentally 'deletes his entire company' with one line of bad code | News | Lifestyle | The Independent (5 Replies)
Discussion started by: wisecracker
5 Replies

3. Shell Programming and Scripting

Script going upward and downward direction

Hello, I have a log file as shown below. Each line starts with instance nr. : Session: IP Processing HTTP Socket Command : Connecting User-Agent Media: : NOT Rejected Media : Session: Username Request Channel : Username : Check if he is in User Database : Username : not in the... (6 Replies)
Discussion started by: baris35
6 Replies

4. Hardware

Plop boot manager Destroy the pc

Hello friends , yesterday i used plop boot manager to shutdown the pc but after using it, nothing happened on screen , i mean cpu is running but monitor show blank screen and then i reassembled the whole pc again ,cleaned , reattach all the devices again but problem persist . Any help (0 Replies)
Discussion started by: rink
0 Replies

5. Solaris

ZFS - Dataset / pool name are the same...cannot destroy

I messed up my pool by doing zfs send...recive So I got the following : zpool list NAME SIZE ALLOC FREE CAP DEDUP HEALTH ALTROOT rpool 928G 17.3G 911G 1% 1.00x ONLINE - tank1 928G 35.8G 892G 3% 1.00x ONLINE - So I have "tank1" pool. zfs get all... (8 Replies)
Discussion started by: eladgrs
8 Replies

6. Shell Programming and Scripting

How to recursively search and destroy tabs

Inspite of my best efforts, eclipse 3.5 seems to continue to misbehave and insert tab characters in my source code. How do I write a script execute from emacs to search all my files for tab characters and conveniently position me on the line of code that has the offending tab? Here are my... (7 Replies)
Discussion started by: siegfried
7 Replies

7. Shell Programming and Scripting

sed -i destroy symlink - how to solve this ?

After a few hours of frustration because I didn't understand why my symlinks are destroyed i just found out that sed -i will destroy symlinks. I searched but i didn't found any good solution for this. Is there any way to overcome this ? On my ubuntu server sed version is 4.1.5 edit: Sorry... (0 Replies)
Discussion started by: ktm
0 Replies

8. Solaris

How to destroy hardware raid on T5120

Hi, I have problem creating hardware raid on T5120 with 4 disks. After the hardware raid 1 created, then I used the raidctl -l c1t0d0 and raidctl -l c1t2d0 the output of volume c1t0d0 contain disk 0.0.0 0.1.0, also the volume c1t2d0 contain disk 0.0.0 0.1.0 and should be 0.2.0 0.3.0 so I... (15 Replies)
Discussion started by: netlink
15 Replies

9. Debian

Don't want destroy windows! Ask skills

I am going to install Linux/Debian on my computer. My current OS is windows 98. My question is that if I install Linux, it is required to partition the hard drive. Windows may be destroyed. I still want to keep it. I have no windows installtion CD. I don't want to buy it. Can I avoid... (1 Reply)
Discussion started by: zhshqzyc
1 Replies

10. UNIX for Dummies Questions & Answers

Looking for a good way to search & destroy lines

What is a good way to find an entry in a .conf file and then remove all lines associated with that entry? I have a Samba server running on Linux that I would like to easily add/remove share entries in the smb.conf file without removing or deleting lines that are not associated with that section.... (5 Replies)
Discussion started by: darthur
5 Replies
Login or Register to Ask a Question