I have a File that contains list of servers and I just want to append a domain-name (say .xyz.com ) at the end of line.
# head -5 serverlist.txt
server1
server2
server3
server4
server5
# sed -ie 's/$/.xyz.com/' serverlist.txt
# head -5 serverlist.txt
server1.xyz.com
server2.xyz.com
server3.xyz.com
server4.xyz.com
server5.xyz.com
# head -5 serverlist.txt
server1
server2
server3
server4
server5
# sed -ie 's/$/.xyz.com/' serverlist.txt
# head -5 serverlist.txt
server1.xyz.com
server2.xyz.com
server3.xyz.com
server4.xyz.com
server5.xyz.com
#
Another method using Awk:
awk '{ print $0 ".xyz.com" }' < serverlist.txt > resultfile.txt
Another method using Awk:
awk '{ print $0 ".xyz.com" }' < serverlist.txt > resultfile.txt
No comments:
Post a Comment