Not specific to
CentOS but I know you guys would be really helpful anyhow. Basically, I
have a file which has been editted in the past very similarly to the hosts file
only now I want to use it as a hosts file and need to run some fancy sed to
massage the data into shape. Currently, the data in the file is in the
form of <ip address> <tab> <short hostname>
<space> <short hostname alias>. In some cases there may
not be any aliases so the end of line would be right after the short hostname
(no space at the end either). In other cases there could be many space
separated short hostname aliases. What I have been trying to do without
success is add our domain name to the first string after the ip address and tab
character. As an example,
== Before
==
1.1.1.1 foo
10.10.10.10 bar bar2
100.100.100.100 foobar foobar2
foobar3
== After
==
1.1.1.1 foo.contoso.com
10.10.10.10 bar.contoso.com bar2
100.100.100.100 foobar.contoso.com foobar2
foobar3
Any advice on how to
pull this off? Thanks.