awk question

Please support our Shell Scripting advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Jun 2007
Posts: 1
Reputation: kholloi is an unknown quantity at this point 
Solved Threads: 0
kholloi kholloi is offline Offline
Newbie Poster

awk question

 
0
  #1
Jun 4th, 2007
Hi Guys,

I am using a BASH script to add users to an ACL in the squid.conf file. Basically the script searches for a string and adds a variable to the end of the string like this:
Shell Scripting Syntax (Toggle Plain Text)
  1. cat /etc/squid/squid.conf | awk "/INTERNET/{ $0=$0 " $UNAME" } {print} " > /tmp/sq.conf
  2. mv /tmp/sq.conf /etc/squid/squid.conf
Now the problem is that there is more than one occurrence of the search string (INTERNET in this case). I want awk to stop after the first successful operation.
At the moment it is adding the user to the ACL and again where it finds 'INTERNET' in the http_access directive.
Thanks
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Shell Scripting Forum
Thread Tools Search this Thread



Tag cloud for Shell Scripting
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC