Hi Forum,
i'm forwarding, as requested, here, what i've asked in a ticket:
Quote:
Tom, do you know how can i change the IP EVERYWHERE on my server? If i use a standard recursive "sed" -see above-, it will substitute al symlinks with static files.
#!/bin/sh
grep -rl OLDIP ./ |
while read filename
do
(
echo "Editing: $filename"
sed -i "s/OLDIP/NEWIP/g;" $filename
)
done
This is just because the initial grep, also searches in symlinks:
SRV:/etc/apache2/sites-enabled# grep -rl OLDIP ./
./00_master.conf
./ispcp.conf
SRV:/etc/apache2/sites-enabled#
As you can see, those files are symlinks:
SRV:/etc/apache2/sites-enabled# ls -lha
total 8.0K
drwxr-xr-x 2 root root 4.0K Aug 4 12:18 .
drwxr-xr-x 8 root root 4.0K Aug 4 12:15 ..
lrwxrwxrwx 1 root root 33 Aug 4 12:18 00_master.conf -> ../sites-available/00_master.conf
lrwxrwxrwx 1 root root 29 Aug 4 12:18 ispcp.conf -> ../sites-available/ispcp.conf
SRV:/etc/apache2/sites-enabled#
Any idea?
Have you ever done something similar?
Thankyou!
EDIT:
Found this in your documentation, but still have the same problem!
find ./ -type f -exec sed -i 's/98\.76\.54\.32/12\.34\.56\.78/' {} \;