0

I want to replace in index.html using one of the default debian linux tool the following:

="([A-z]+).html"

with

="javadoc/$1.html"

index.html file contains the following:

<frame src="overview-frame.html" name="packageListFrame" title="All Packages">
<frame src="allclasses-frame.html" name="packageFrame" title="All classes and interfaces (except non-static nested types)">
</frameset>
<frame src="overview-summary.html" name="classFrame" title="Package, class and interface descriptions" scrolling="yes">
Link to <a href="overview-summary.html">Non-frame version</a>.</p>

I have started using sed but I have expression error:

sed -E 's,="([^"]+)\.html",="javadoc\/\1.html",' public/javadoc/index.html
3
  • 1
    "I want to replace" (what?) "in index.html ..." and sed -E "s/=\"([A-z-]+)\"/\1something\2/" has only 1-capture but uses \1...\2 (e.g. 2) backreferences?? Commented Mar 27, 2019 at 15:06
  • 1
    Try sed -E 's,="([^"]+)\.html",javadoc/\1.html,' public/javadoc/index.html Commented Mar 27, 2019 at 15:07
  • Thanks, it worked, you should have posted answer Commented Mar 27, 2019 at 15:10

2 Answers 2

1

try this:

sed "s/\([^\"]*\.html\)/javadoc\/\1/g" public/javadoc/index.html

explanation

s/                # substitute
\(                # start arg1
[^\"]*\.html      # all char before .html without "
\)                # end of arg1
/javadoc\/\1      # replace with javadoc/arg1
/g                # global on whole line
Sign up to request clarification or add additional context in comments.

Comments

1

I don't get it yours perfectlly correct

sed -E 's,="([^"]+)\.html",="javadoc/\1.html",' public/javadoc/index.html

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.