Shell script for replacing some files with symlinks

ftpshellsvn

Some servers only support ftp to upload files.

When I export the a project from my subversion repository to my windows machine, all (linux) symlinks are replaces by placeholder-files:

link ../www_public/images

after uploading the all exported files I now use

find | xargs grep -P ^link

to find all those placeholders. I then replace them with the actual symlink manually.

I would really like to automate this step with a shell-script.
How would I do this?

Note:
If there is a better / different solution to this problem, don't hesitate to share it 🙂

Best Solution

Here's one possible solution:

:
grep -lr '^link' . | while read placeholderfile
do
  linkfile=`cut -c6- "$placeholderfile"`
  ln -sf "$linkfile" "$placeholderfile"
done

edit: changed code above w.r.t. the comments below.