The first will work (I tried it); however, because of the way the script runs, a repeat run will add another #.
The second option will work if you assume that there's no other problem and only 2 hashes exist.
I think a better solution might be (which I'm figuring out) to tell 'sed' to replace 1 or more instances of a # that begins at ^ up to the next alphanumeric character, which in this case is always 0 (zero).
OR
Use 'sed' to simply search for the matching line, delete it and replace with another full line that has the hash removed already. This might be more efficient/reliable.
Suggestions welcomed. This is one of those good learning experiences... :-)
Quote:
Originally Posted by dive
s/^#0/0/g
or maybe
s/^##/#/g
To turn ## into #
|