For example
Input
<url wiki=https://wiki.archlinux.org/index.php/Main_Page forums=https://bbs.archlinux.org/>
Desired output
<url wiki="https://wiki.archlinux.org/index.php/Main_Page" forums="https://bbs.archlinux.org/">
Here’s a sample command to start with, that replaces = with “=”. In my simple mind, there would be some way of making it search for the next word after equals, and enclosing that. I’m not sure if that exists, but any help is appreciated.
echo "<url wiki=https://wiki.archlinux.org/index.php/Main_Page forums=https://bbs.archlinux.org/>" | sed 's/=/"&"/'
Your suggested regex (
sed 's/=/"&"/') would replace the=with"=", which is not what you need. This seems to work correctly on your sample data:Replace an equals sign followed by a non-blank, non-quote, non-greater-than and a string of other non-blank, non-greater-than characters with an equals sign, a double quote, the remembered string and another double quote, globally on each line.