Skip to content
Advertisement

Sed – How to Print Regex Groups in Multi-Line?

Input file (test):

JavaScript

Desired output:

JavaScript

What I have done:

JavaScript

Question: How do you print the regex groups in sed (multiline)?

Advertisement

Answer

If you use sed like this:

JavaScript

then it will print in different lines:

JavaScript

But is this what you are trying to print? Or you want to print text in hrefs?

Update 1: To get hrefs between well formed <a and </a>

JavaScript

output

JavaScript

Update 2: Getting above output using bash regex feature

JavaScript

output

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement