Greetz folks.
I'm looking for a way to do the same stuff than PHP's preg_replace() does (search text matching a regular expression and replace it) in a shell script.
So, consider the following file.
<a href="http://example.com/">Website #1</a>
<a href="http://example.net/">Website #2</a>
<a href="http://example.org/">Website #3</a>
And I want to get this:
http://example.com/
http://example.net/
http://example.org/
Is there a way to do this? Thanks.
You can use sed
as:
sed -r 's/.*href="([^"]*)".*/\1/' file
See it
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With