Logo Background

Unix Find And Grep Command

  • By on August 17, 2008 | 1 Comment

    If you want to find for a file name that consist the strings “description” in Unix, you can refer the command as below.

    Find Grep Unix Command

    find . -exec grep "description" '{}' \; -print

    This find command will return the file name that contains the strings “description” in file

    Next
    » Oracle 10g Active Connection SQL
  1. #1 Jing Hong
    September 15, 2010 3:52 am

    Use the command as below if you just want to list the filename: –

    1) find . -exec grep “description” ‘{}’ \; -print | grep “./”

    2) find . -exec grep “description” ‘{}’ \; -print | grep “./” | awk ‘{ print substr($0,3) }’

    Command (1) will display the result with ./ while command (2) will not display it.

    Post ReplyPost Reply
Leave a Comment