Mar 25, 2004 #1 maxcrook Programmer Joined Jan 25, 2001 Messages 210 Location GB I have a file that contains date like so server1 server2 server3 server4 What i need to do is to output the hostname to the file placing it on each line next to the server ie server1 tsm1 server2 tsm1 server3 tsm1 Hope that makes sense!
I have a file that contains date like so server1 server2 server3 server4 What i need to do is to output the hostname to the file placing it on each line next to the server ie server1 tsm1 server2 tsm1 server3 tsm1 Hope that makes sense!
Mar 25, 2004 #2 grega Programmer Joined Feb 2, 2000 Messages 932 Location GB A couple of ways. nawk -v host=`hostname` '{print $0 " " host}' datafile or awk '{print $0 " " host}' host=`hostname` datafile Greg. Upvote 0 Downvote
A couple of ways. nawk -v host=`hostname` '{print $0 " " host}' datafile or awk '{print $0 " " host}' host=`hostname` datafile Greg.
Mar 25, 2004 Thread starter #3 maxcrook Programmer Joined Jan 25, 2001 Messages 210 Location GB Hi greg thanks very much for these - spot on exactly what i wanted. Brilliant. Upvote 0 Downvote