Re: remove text
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.
|