BASH: sed question
hey guys,
I don't get regex and I need to figure out how to use sed to uncomment some stuff in /etc/httpd/conf/httpd.conf. I need to find the following text Code:
# <Location /server-status> Code:
<Location /server-status> |
Hi,
The following will look for a range (starting with: # <Location /server-status> and ending with: # </Location>. If found the first # and space are removed: sed '/# <Location \/server-status>/,/# <\/Location>/s/^# //' infile Do check if the output is correct before making it definite, the range could be "greedy" (larger range then expected) due to possible inconsistencies in the input file. Hope this helps. |
Thank You. I will give this a go
|
Didn't work, it made a copy of all of that code and a few lines above it and pasted them below it. Instead of deleting "# " it just deleted the space. so I am left with
Code:
#<Location... Code:
<Location... |
Hi,
Quote:
Could you paste a relevant part of the input file (including what's above and below). This happens with your example from post #1 and the sed command I supplied: Code:
$ cat infile |
No worries, I got it sorted. I tinkered with your expression and figured it out. I just removed all the spaces and it works fine.
|
All times are GMT -5. The time now is 07:26 PM. |