ekg is small bash script wiriten to parse package.use package.mask package.umask package.accept_keywords make.conf
also it is capable to add new conditions as delete exisiting ones in every earlier mentioned files and more. Passing r flag it can recurivly edit your files where specified is founded. It uses EDITOR env variable for editig pripose.
if (r) in in action you can specify basname of file: ex: ekg r package.use
there is a lot more, feel free to try and reuse code
NOTE: there is highlight option line in recursivly method so if you choose another editor which is not VIM as my defualt one, you wont get highlightitn lines for specified .