#!/bin/bashs="some thing <phrase>a phrase</phrase> some thing else <phrase>other stuff</phrase>"perl -pe 's{>.*?</}{ $& =~ tr/ /_/r }eg' <<< "$s"
Standard input is empty
some thing <phrase>a_phrase</phrase>_some_thing_else_<phrase>other_stuff</phrase>
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!