I have a question using ex in a bash script.
I have a file like that
data.txt
hello
foo
bar
foo
bar
hello
foo
bar
foo
bar
hello
Now I want to run a little macro over all patterns matching "hello" and I want to modify it to "hello world".
I'm using this script for that
ex -s data.txt << script
let @q="A world"
g/hello/normal @q
wq
script
I define a macro and put it to register q. Afterwards I execute this macro in all lines matching "hello". But it looks like that it's not working.
Now I'm wondering if ex scripting is limited somehow.
I know that there are hundreds of ways to achieve the same differently, but I want to use a macro in that case.
Thanks for your help!

