Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a script with the follow code:

find . -name "*.html" -print0 | while IFS= read -r -d '' n; do
sed -i -r 's/<font color="#bbbbbb">\.<\/font>.*?<input[^µ]*?mabulle\.hide\(\)">//1' "$n" 
sed -i -r 's/<\/body>/<a href="\.\/00Tree\.html">Back<\/a><\/body>/' "$n" #add back link

The second sed is not working. If I run

sed -i -r 's/<\/body>/<a href="\.\/00Tree\.html">Back<\/a><\/body>/' filename.html

from the command line it works perfectly.

The html files are named 0_name.html, 1_name.html, etc.

What am I doing wrong?

share|improve this question

closed as too localized by Dennis, Scott, Ƭᴇcʜιᴇ007, Tanner Faulkner, Breakthrough May 25 '13 at 5:29

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

Does your second sed works after processing the first one from command line? Can you give a tiny html sample to understand better the meaning of working? – olibre May 22 '13 at 17:22
Oh boy. I just discovered why it was working. I was editing a copy of the script, not the one I was running. I'm feeling stupid. – To Do May 22 '13 at 17:26
@ToDo glad you found it, please close the answer out. – Rich Homolka May 22 '13 at 17:42

There was nothing wrong with the code. I was simply editing a copy of the script instead of the one I was running.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.