944,098 Members | Top Members by Rank

Ad:
Jun 4th, 2007
0

awk question

Expand Post »
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
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
kholloi is offline Offline
1 posts
since Jun 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Shell Scripting Forum Timeline: Swaping Files
Next Thread in Shell Scripting Forum Timeline: What does @ mean???





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC