sed command working in command line but not in script
8,471
There was nothing wrong with the code. I was simply editing a copy of the script instead of the one I was running.
Related videos on Youtube
Author by
To Do
Updated on September 18, 2022Comments
-
To Do over 1 year
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 done
The second
sed
is not working. If I runsed -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?
-
oHo almost 11 yearsDoes 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? -
To Do almost 11 yearsOh 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.
-
Rich Homolka almost 11 years@ToDo glad you found it, please close the answer out.
-