Help with grep

This is a discussion on Help with grep within the C Programming forums, part of the General Programming Boards category; Say I want to search a director for the beginning of the task_struct declaration such as "struct task_struct {". What ...

  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
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,248
    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, 02:30 AM
  2. simple grep problem
    By cdave in forum Windows Programming
    Replies: 7
    Last Post: 12-29-2005, 04: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, 11:11 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21