Page 1 of 1
[CLOSED] howto use awk inside Woof-CE EXTRA_COMMANDS?
Posted: Fri Mar 01, 2024 5:39 pm
by peebee
CLOSED - solution provided by JamesBond - many thanks.
I want to add some code into the EXTRA_COMMANDS of Woof-CE 3builddistro to make a mime entry in freedesktop.xml have different extensions.
i.e I want to change .m3u & .m3u8 at lines 21 & 22 of cut-freedesktop.xml to
.xm3u and .xm3u8
I have been experimenting with using awk.
The file awk.sh.txt shows at line 7 an awk command that does the trick if called directly in a terminal
awk -i inplace '/m3u/{c+=1}{if(c==6 || c==7){sub("m3u","xm3u",$0)};print}' cut-freedesktop.org.xml
but the same code (+ some escapes) at lines 2 & 3 does not work ( sh awk.sh.txt )..... and this is how it would need to be embedded in EXTRA_COMMANDS....
Grateful if anybody can suggest coding that will work when embedded - thanks.
Re: howto use awk inside Woof-CE EXTRA_COMMANDS?
Posted: Fri Mar 01, 2024 7:18 pm
by jamesbond
You forgot to quote $0.
Should \$0
instead of $0
on line 2.
But why do it this way? Why not just use shell functions instead of eval?
Re: howto use awk inside Woof-CE EXTRA_COMMANDS?
Posted: Fri Mar 01, 2024 7:22 pm
by peebee
jamesbond wrote: Fri Mar 01, 2024 7:18 pm
You forgot to quote $0.
Should \$0
instead of $0
on line 2.
But why do it this way? Why not just use shell functions instead of eval?
Many thanks JB...... this is how Woof-CE 3builddistro actions the EXTRA_COMMANDS in _00build.conf
Re: howto use awk inside Woof-CE EXTRA_COMMANDS?
Posted: Fri Mar 01, 2024 10:38 pm
by dimkr
It would be easier to replace this horrible EXTRA_COMMANDS thing with an optional script that runs at the end of the build, so no eval and escaping is needed.