User forums > Using Code::Blocks
How to add grep command to the Tools menu
(1/1)
jackhab:
I need to extract several lines from active source file. I tried to add grep command to the Tools menu like this (I'm using dummy pattern for the test) :
--- Code: ---Name: List ints
Executable: /usr/bin/grep
Parameters: '-e int' ${ACTIVE_EDITOR_FILENAME}
Launch tool hidden with standard output redirected
--- End code ---
The tool fails with the following log:
--- Code: ---Launching tool 'List ints': /usr/bin/grep '-e int' /media/backup/mylinux/projects/trunk/Manager/Main.cpp (in /media/backup/mylinux/projects/trunk/MrStreamManager)
stderr> execvp(/usr/bin/grep, -e int, /media/backup/mylinux/projects/trunk/Manager/Main.cpp) failed with error 2!
stderr>
stdout>
Tool execution terminated with status 255
--- End code ---
What seems to be the problem here? Do I need some quoting tricks?
Thanks.
zabzonk:
You don't want the quotes arou8nd the -e flag:
Name: List ints
Executable: /usr/bin/grep
Parameters: -e int ${ACTIVE_EDITOR_FILENAME}
jackhab:
Still has the problem
--- Code: --- execvp(/usr/bin/grep, -e, int, /media/backup/m...cpp) failed with error 2!
--- End code ---
Jenna:
--- Quote from: jackhab on October 12, 2009, 12:22:17 pm ---Still has the problem
--- Code: --- execvp(/usr/bin/grep, -e, int, /media/backup/m...cpp) failed with error 2!
--- End code ---
--- End quote ---
Make sure grep is in /usr/bin !
On my system (debian) it is in /bin !
EDIT:
You do not need to use the absolute path, if grep is in your searchpath.
jackhab:
U-N-B-E-L-I-E-V-A-B-L-E ! ! !
It is in /bin. I forgot to 'which grep'. Thank you so much, jens.
Navigation
[0] Message Index
Go to full version