Thread: Help with grep

  1. #1
    Registered User
    Join Date
    Nov 2007
    Posts
    96

    Help with grep

    Say I want to search a director for the beginning of the task_struct declaration such as "struct task_struct {". What would the grep command be to achieve this if I want to search the kernel/ directory

  2. #2
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Quote Originally Posted by NuNn View Post
    Say I want to search a director for the beginning of the task_struct declaration such as "struct task_struct {". What would the grep command be to achieve this if I want to search the kernel/ directory
    Go to the root of the source tree and:

    Code:
    grep -Hirl 'struct task_struct {' .
    Obviously this will only find it if it's actually written precisely that way in the code... Personally, I use cscope to navigate such large codebases.
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. programming with grep
    By George2 in forum Tech Board
    Replies: 4
    Last Post: 11-18-2006, 03:30 AM
  2. simple grep problem
    By cdave in forum Windows Programming
    Replies: 7
    Last Post: 12-29-2005, 05:48 PM
  3. Grep Last Pattern Output
    By cfriend in forum Linux Programming
    Replies: 1
    Last Post: 09-18-2004, 10:14 AM
  4. Grep
    By cfriend in forum Linux Programming
    Replies: 3
    Last Post: 09-17-2004, 05:34 AM
  5. grep
    By Unregistered in forum C Programming
    Replies: 3
    Last Post: 02-26-2002, 12:11 PM