Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.
Hi all, please see this major site announcement: https://www.boards.ie/discussion/2058427594/boards-ie-2026

Using grep with subdirectories

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


    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,415 ✭✭✭✭Trojan



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

    Cheers, anyway...

    Al.


  • Registered Users, Registered Users 2 Posts: 16,415 ✭✭✭✭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