I have a file which contains the below
hosts: files
ipnodes: files
networks: files
protocols: files
rpc: files
ethers: files
netmasks: files
I need to append "dns" at the end of only this two lines
hosts: files dns
ipnodes: files dns
Solaris servers, having very limited options in sed sed -i is not available looking for a workaround
sed without any fancy settings or in place updates would work:
If you need to make this edit to ONLY lines beginning with lines beginning with hosts and ipnodes, then add a filter to the command:
Note: I am assuming you'll redirect output to a new file, and replace it with the old.