LWONG@UVPHYS.BITNET (03/22/89)
Is there an easy to do this?
george@hyper.lap.upenn.edu (George "Sir Lleb" Zipperlen) (03/22/89)
Is there an easy way to find all links referring to a file object? You didn't say whether you meant unix hard links, unix soft links, or aegis links. For Aegis links try /com/ld -c -lt -ll '//?*/...' | fpat 'name_of_file_object' note: the '//?*/...' wild card will search your entire network, you may want to search a smaller area! Unix soft links are a bit harder (under sr9, under sr10 they're the same as aegis links) and will need several steps: first: find all slinks, using /com/ld -c -tu '//?*/...' | fpat slink | awk '{print $2}' > /tmp/links.tmp the awk command is to get rid of the first column containing "slink" you can use ver sys5 cut, sed, or edstr to do this too. second: write a script, for loop, or whatever that takes each line in the temp-file and does an ls to extract the name of the object pointed to. (the csh foreach loop I'm using will break if the file is too long) foreach name (`cat /tmp/links.tmp `) ls -l $name | fpat 'name-of-file-object' end A unix shell expert could probably tweak 'find' to do all this, but I prefer the '...' aegis wild card. if any of the names contain upper case, leading '.', or other strange characters, this won't work on pre sr10 systems. e.g. "Makefile" looks like ":makefile" to sr9x Aegis. I have a filter that converts such names (I think I only bothered with the upper case and leading '.' problems) It's trivial for these two cases. file names with blanks in them are a royal pain in the <anatomical region of your choice>. for Unix hard links you'll have to play with i-nodes... George Zipperlen george@apollo.lap.upenn.edu george@hyper.lap.upenn.edu ...!{rutgers, uunet, mit-eddie, decwrl}!upenn.edu!apollo.lap!george Blatant plug for funky-music@apollo.lap.upenn.edu "Won't be no Static" -JB