I want to parse my sources.list
to extract the list of repositories. I have:
## Some comment
deb http://some.vendor.com/ubuntu precise stable
deb-src http://some.vendor.com/ubuntu precise stable
deb http://some.othervendor.com/ubuntu precise experimental # my current favorite
I want:
http://some.vendor.com/ubuntu precise stable
http://some.othervendor.com/ubuntu precise experimental
So I need: only lines with “deb” at the beginning and until the end of the line or a #
character, but excluding it. So far I have:
grep -o "^deb .*"
But how do I match #
or end of line without matching the #
?