next up previous
Next: Utilities Up: SAS on Unix Previous: Why does proc import

Searching for files on Unix

To search for all files in a directory that match a particular expression, use Unix's find command. For instance

  find . -name '*sas'

finds all files in the current directory (.) whose names end in sas.

This is even more useful than it seems at first glance. You can search for text within the files:

  find . -name '*sas' | xargs grep 'sastemp'

searches all the SAS files found for the string 'sastemp'. The xargs command takes the output of find and gives it to grep one line at a time.

Andre de Souza 2012-11-19