Soft link issue

I did restore from netbackup for root file system on separate slice instead of corrupted one. After restoration I found there are number of soft link issues lie

e.g

libabcxyx > /mnt/usr/lib

it should be

libabcxyz > /usr/lib

does any have solution to change symbolic link changed in mass and across the file system.

Nimish

You can run this script and look at its output:

find / -type l -exec ls -l {} \; 2>&1 | nawk '
{
  l1=$9
  l2=$10
  l3=$11
  if($12!="") {
    printf("# ignoring %s\n",$0)
    next
  }
  if(l2=="->" && $12=="") {
    if(l3 ~ "^/mnt")
    {
      l4=l3
      sub("/mnt","",l4)
      printf("rm %s && ln -s %s %s\n",l1,l4,l1)
    }
  }
}
' > /tmp/fixlinks.sh

Reviewing fixlinks.sh before running it !