Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Using grep with subdirectories

  • 05-07-2000 12:13pm
    #1
    Registered Users, Registered Users 2 Posts: 16,414 ✭✭✭✭


    Got it working with:
     find ./ -name "*.[c|h]" -print|xargs grep TPF
    

    Al.


Comments

  • Registered Users, Registered Users 2 Posts: 3,744 ✭✭✭deRanged


    you know you can use commands in the find statement?
    ie
    find . -name "*.[c|h]" -exec fgrep -l {} \;

    might be handy.


  • Closed Accounts Posts: 102 ✭✭OctaviaN


    Yeah as above
    lol smile.gif


  • Registered Users, Registered Users 2 Posts: 16,414 ✭✭✭✭Trojan



    deRanged: that's what I said... cept using | rather than exec...

    Cheers, anyway...

    Al.


  • Registered Users, Registered Users 2 Posts: 16,414 ✭✭✭✭Trojan


    Hi all,

    can any of you Unix wizards tell me how to grep through several subdirectories? I can't find a grep option to do the same.

    I tried the find command as follows (I was looking for the string "TPF":
    find ./ -name "*.[c|h]" -print| /dev/null grep TPF
    
    but this didn't work.

    Any ideas?

    Cheers,
    Al.


Advertisement