The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #4 (permalink)  
Old 05-26-2007
ghostdog74 ghostdog74 is offline Forum Advisor  
Registered User
  
 

Join Date: Sep 2006
Posts: 2,555
assuming you know the file name

Code:
#!/bin/sh
ls -lR / | awk -v filename="$1" '/^\//{ dir=$0} 
                /^-/{ if ( $9 == filename ) { 
		       print "Found " filename " in "dir
		      }
		
		}'


Last edited by ghostdog74; 05-26-2007 at 06:28 AM..