Author Topic: How to add grep command to the Tools menu  (Read 6777 times)

Offline jackhab

  • Multiple posting newcomer
  • *
  • Posts: 16
How to add grep command to the Tools menu
« on: October 12, 2009, 11:39:24 am »
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

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

What seems to be the problem here? Do I need some quoting tricks?

Thanks.



zabzonk

  • Guest
Re: How to add grep command to the Tools menu
« Reply #1 on: October 12, 2009, 12:05:37 pm »
You don't want the quotes arou8nd the -e flag:

Name: List ints
Executable: /usr/bin/grep
Parameters: -e int ${ACTIVE_EDITOR_FILENAME}

Offline jackhab

  • Multiple posting newcomer
  • *
  • Posts: 16
Re: How to add grep command to the Tools menu
« Reply #2 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!

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7252
Re: How to add grep command to the Tools menu
« Reply #3 on: October 12, 2009, 12:35:31 pm »
Still has the problem

Code
 execvp(/usr/bin/grep, -e, int, /media/backup/m...cpp) failed with error 2!

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.

Offline jackhab

  • Multiple posting newcomer
  • *
  • Posts: 16
Re: How to add grep command to the Tools menu
« Reply #4 on: October 12, 2009, 01:40:37 pm »
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.