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 UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #4 (permalink)  
Old 05-26-2007
ghostdog74 ghostdog74 is offline
Registered User
 

Join Date: Sep 2006
Posts: 1,434
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 02:28 AM.
Reply With Quote