On 14 April 2010 02:41, Atif Jung <atifjung(at)gmail(dot)com> wrote:
> Sorry Glenn, I should have made it clear, when I said 'var[x,y]' is
> completely variable I meant the whole string, so it could look like:
>
> var[x,y]
> :h_def[x,y]
> hello[x,y]
>
> and so on ....
echo "var[x,y]
:h_def[x,y]
hello[x,y]" | sed -r 's|^([^[]+)\[([^,]+),([^]]+)\]|\1 FROM \2 FOR \3|'
var FROM x FOR y
:h_def FROM x FOR y
hello FROM x FOR y
Does that help?
Cheers,
Andrej
--
Please don't top post, and don't use HTML e-Mail :} Make your quotes concise.
http://www.american.edu/econ/notes/htmlmail.htm