sed magic

I want to become an expert @ using sed, but i do not have enough time...

Atm I have a repository in my apt/sources.list but it is commented out since i do not want to install packages from it (backtrack repository) except the exploitdb package.

I would like make a command, lets say "update-exploitdb" which uncomments the specific repository at my apt/sources.list (using sed probably), then updates, and then re-installs the exploitdb package at the newest version. After doing that, the backtrack repository is commented again.

So, i would like to know the way to do this text edit with sed...

...
...
...
############################################### BACKTRACK REPOS
#deb http://archive.offensive-security.com pwnsauce main microverse restricted universe multiverse

I would appreciate any help..

You could open the file in an editor and remove the hash mark. I'm not familiar with apt, but if it's similar to yum, it'll have an option to enable a specific repository. With yum, I'd just use enablerepo=backtrackrepo.etc.
I'd suggest you read man apt.

I guess i was totally misunderstood. I am sorry for my english usage...
What i am asking is this:

Could anyone share a sed command that removes the # character from the beginning of a line that i want to in the apt/sources.list file? What is the command to use again if i want to put the # character back where it was? The specific line that i want to do that is the following:

############################################### BACKTRACK REPOS
#deb http://archive.offensive-security.com pwnsauce main microverse restricted universe multiverse

ps: The second question is not 100% necessary since i can just copy a backup over the last edited file to get my # char back. But using a sed command makes it more elegant.

sed 's/^#deb/deb/' infile > outfile && mv outfile infile

to put it back

sed 's/^deb/#&/' infile > outfile && mv outfile infile

If you have GNU sed then you can do this:

sed -i 's/^#deb/deb/' file
sed -i 's/^deb/#&/' file

Thank you for your reply scrutinizer.
I think this command works for every entry that is commented in my /etc/apt/sources.list file. But i can manage it to work by using grep to change only the particular entry that i mentioned.

Thank you very much.

Hi redsolja,

No need for grep, you can use any pattern in the sed statement to only select one particular line, for example

sed -i '/^#deb http:.*offensive/s/#//' file
sed -i '/^deb http:.*offensive/s/^/#/' file