User forums > Using Code::Blocks

[RESOLVED] [Pre-/Post-build steps] Pipe redirection

(1/1)

smalcom:
I'm trying to use pipe redirection in pre-build script


--- Code: ---grep -r avr_kind_t $(PROJECT_DIR)simavr/cores/ | awk -F '[ :]' '{print $1 "=" $3;}'
--- End code ---
and got error:

--- Quote ----------------- Build: Config in simavr (compiler: GNU GCC Compiler)---------------

Running target pre-build steps
grep -r avr_kind_t ...path.../simavr/cores/ | awk -F '[ :]' '{print  "=" ;}'
Usage: awk [POSIX or GNU style options] -f progfile [--] file ...
....
--- End quote ---

Good, i added '$':

--- Code: ---grep -r avr_kind_t $(PROJECT_DIR)simavr/cores/ | awk -F '[ :]' '{print $$1 "=" $$3;}'
--- End code ---

And got:

--- Quote ----------------- Build: Config in simavr (compiler: GNU GCC Compiler)---------------

Running target pre-build steps
grep -r avr_kind_t ...path.../simavr/cores/ | awk -F '[ :]' '{print $1 "=" $3;}'
Usage: awk [POSIX or GNU style options] -f progfile [--] file ...
...

--- End quote ---

I selecting last command from output:

--- Code: ---grep -r avr_kind_t ...path.../simavr/cores/ | awk -F '[ :]' '{print $1 "=" $3;}'
--- End code ---
paste it to console and got result without error:

--- Quote ---user@host ...path.../simavr/simavr $ grep -r avr_kind_t ...path.../simavr/cores/ | awk -F '[ :]' '{print $1 "=" $3;}'
...path.../simavr/cores/sim_mega48.c=mega48
....

--- End quote ---
What i'm doing wrong?
Thanks.

smalcom:
Problem resolved: internal single quotes

--- Code: ---'
--- End code ---
must be changed with
--- Code: ---'\''
--- End code ---
Result:

--- Code: ---bash -c 'grep -r avr_kind_t cores/ | awk -F '\''[ :]'\'' '\''{print $1 "=" $3;}'\'''
--- End code ---

Navigation

[0] Message Index

Go to full version