0

I want to massively change some css references in more than 200 html files. Most of the files are static HTML generated automatically. Now, I need to change the location of some css files. So, I used that sed:

sed -s 's/href="*_css/href="css/g' ./12*.htm*

The source is like that:

href="11.2.Lab%20_css/styles.css"
href="10.2.Lab%20_css/styles.css"

But running the sed, nothing happen!

Where is the error?

1 Answer 1

2

It's confusing, but * matches an arbitrary string in bash, whereas in regular expressions * repeats the previous pattern an arbitrary number of times.

So you need .* instead of * (match any character any number of times); your string specifies an arbitrary number of double-quotes followed by underscore.

Note that the dots in the source strings are unrelated to the . in the regular expression, which matches any character, including itself.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .