Hi Folks,
I was given a task to append three IP's at the end of a specific (and unique) line within a file on multiple servers.
I was not able to do that with the help of a script. All I could was:
for i in server1 server2 server3 server4
do
ssh $i
done
I know 'sed' could be used to append to the end of the line but how to save that and replicate on all servers in the list?
Original File
-----------
#cat /etc/ftpd/ftpaccess
greeting brief
log commands
log transfers
class users real 172.25.6.148 172.25.197.148 172.25.52.100 172.21.56.75 172.21.54.159 172.25.2.25 172.25.2.26 172.25.119.132 172.25.119.133 172.25.119.134 172.25.119.135 172.25.183.132 172.25.183.133 172.25.183.134 172.25.183.135
banner /etc/ftpd/banner.txt
(each server had different IP's in the line starting with: class
users real .....):
Change required:
----------------
Append "172.21.105.99 172.21.105.100 172.21.105.101" at the end of line starting with text:'class users real')
Any help will be appreciating in how would you gurus would accomplish this task with the help of a script / scripted-command.
Thanks in advance