There is a task to edit a text file.  It is entirely possible that
multiple people are going to be running the ruby script that edits
this file at the same time.

I have looked at Ruby cookbook recipe 6.13 and 20.11.  These seem like
what I am wanting.

It seemed like a good idea to float this as a solution before it is
implemented.

How I do it now is using sed:

flock $USERFILE sed -i \
  "/^$1[[:space:]]\+/,+6 { s/^\\(.*Default\\)/#\\1/; s/^#\\(.*SRT\\)/\
\1/; }" \
   $USERFILE

But I'd like to move this piece of code into the ruby script instead
of launching it with a system command.

What other ways are people doing this sort of thing?

BTW, for those of you that don't have the cookbook, it basically
redefines open to include a flock call.

Mike B.