awk remove paragraph with matching string and script

Sed is a stream editor, you give it a file and it outputs it, redirecting the output helps if you want to save it to a file.  I had a couple thousand print queues entries in a file with the name of the queue some information about it and then a carriage return that separates them from each other.  A simple grep would not work because grep -v would only remove the name of the queue while I needed to remove the name of the queue and the information that was associated with it.

Below is a script that I wrote to remove all the entries and loop through the file.  The readin file stored each queue name with each queue name on a new line.


for QUEUE in $($CAT  $PWD/readin)
sed -e /./{H;$!d;}; -e x;/;$QUEUE;/d;  queue_configuration> output
cp output queue.def

Lets analyze the sed line of the script.

We have two separate sed scripts .  The -e signifies that it is a sed script with the script being everything inside the single quote.  In the above example There are two different scripts in order to complete all the tasks.

This is an example of the readin files format

queueone: description = hostname1 Color HP printer form    = port library = FormHP5

queuetwo: description = hostname2 Big HP printer form    = port library = FormHP5