|
|
|
|
||||||
| comp.unix.shell Using and programming the Unix shell. |
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Hi all..
I'm in need of some . I currently manage a subversion server with many repositories and many users in the repositories. When a user no longer requires access to any repo, I have to go into each repo one by one and remove their name. The password file is a simple text file located at */conf/passwd Is there a way that a script can search through all repos and delete each occurrence of the user? for example, I can find out which repository the user is a member of by doing: grep -l "dan" */conf/passwd This will look through each repo and print the subdirectory of the group of which dan is a member of. How can I then automatically remove his name? I don't know the command I need to use -- if someone can tell me the command I can build the script.. |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
Ivan wrote:
> Hi all.. > > I'm in need of some . > I currently manage a subversion server with many repositories and many > users in the repositories. > When a user no longer requires access to any repo, I have to go into > each repo one by one and remove their name. > The password file is a simple text file located at */conf/passwd > > Is there a way that a script can search through all repos and delete > each occurrence of the user? > > for example, I can find out which repository the user is a member of > by doing: > grep -l "dan" */conf/passwd That would produce a false "hit" if "daniel" appeared anywhere in the file or if "dan" just happened to appear somewhere other than the "user id" field. If the file is colon-delimited fields and the user id occurs in, say, the first field, then this would be more accurate: awk -F: '$1 == "dan"{print FILENAME}' */conf/passwd > This will look through each repo and print the subdirectory of the > group of which dan is a member of. dan or daniel or rodan or.... > How can I then automatically remove his name? for file in */conf/passwd do awk -F: '$1 == "dan"{next}1' "$file" > tmp && mv tmp "$file" done > I don't know the command I need to use -- if someone can tell me the > command I can build the script.. Regards, Ed. |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
On 2007-05-17, Ivan wrote:
> Hi all.. > > I'm in need of some . > I currently manage a subversion server with many repositories and many > users in the repositories. > When a user no longer requires access to any repo, I have to go into > each repo one by one and remove their name. > The password file is a simple text file located at */conf/passwd > > Is there a way that a script can search through all repos and delete > each occurrence of the user? > > for example, I can find out which repository the user is a member of > by doing: > grep -l "dan" */conf/passwd grep -l "^dan:" */conf/passwd > This will look through each repo and print the subdirectory of the > group of which dan is a member of. > > How can I then automatically remove his name? > > I don't know the command I need to use -- if someone can tell me the > command I can build the script.. grep -v "^dan:" "$file" > tempfile && mv tempfile "$file" Or: sed '/^dan:/d' "$file" > tempfile && mv tempfile "$file" Or: awk '/^dan:/ { next } { print }' > tempfile && mv tempfile "$file" -- Chris F.A. Johnson, author <http://cfaj.freeshell.org/shell/> Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress) ===== My code in this post, if any, assumes the POSIX locale ===== and is released under the GNU General Public Licence |
|
![]() |
| Outils de la discussion | |
|
|