How to remove lines with while loop whch were previously added
by blason from LinuxQuestions.org on (#4V7DM)
Hi Folks,
I am a little confused here with my script.
I am reading from file; running in while loop; creating the zone.
This is working fine.
However, since I keep adding new entries; due to while loop those are getting added again and again.
Here is what I mean -
Quote:
in the first iteration, I get an output like
Quote:
In the next iteration If I add "new.com" and "net.net" and re-run the script
Quote:
In the next iteration again first lines get added again and again.
I need to find a solution -
so that only new entries will get appended.
Any idea folks?


I am a little confused here with my script.
I am reading from file; running in while loop; creating the zone.
This is working fine.
However, since I keep adding new entries; due to while loop those are getting added again and again.
Here is what I mean -
Quote:
| _EXPL_WHITELIST="/zone/expl_wl_bl/customWL.txt" if [ -f ${_EXPL_WHITELIST} ] then if [ -s ${_EXPL_WHITELIST} ] then cat $_EXPL_WHITELIST | while read line;do echo -e $line'\t'CNAME'\t'rpz-passthru.;done >> $_FINAL_WHITELIST fi fi rndc reload |
Quote:
| productreviews.shopifycdn.com CNAME rpz-passthru. large.edgecast.syn-cdn.com CNAME rpz-passthru. www.anrdoezrs.net CNAME rpz-passthru. scontent-frt3-1.xx.fbcdn.net CNAME rpz-passthru. |
Quote:
| productreviews.shopifycdn.com CNAME rpz-passthru. large.edgecast.syn-cdn.com CNAME rpz-passthru. www.anrdoezrs.net CNAME rpz-passthru. scontent-frt3-1.xx.fbcdn.net CNAME rpz-passthru. new.net CNAME rpz-passthru. new.com CNAME rpz-passthru. |
I need to find a solution -
so that only new entries will get appended.
Any idea folks?