[SWLUG] Awk is driving me MAD!

Terry John terry.john at bbc.co.uk
Wed Jun 11 10:32:05 UTC 2003


There's no such thing as giving up

This works on my Sun box

grep -v ^# /etc/hosts > myhosts
awk '{printf("%s IN A %s\n", $2, $1);}' myhosts

SunOS 5.8
Hi,
  
That makes it a lot shorter! :-) ...but does not work on the Sun[1] :-(
Thanks for trying anyway, it might be something very slightly different for
the Sun but I'm not an awk whizz or have the books. I will give it a go on
my Linux box later, which I suspect will like it ok.

 Given that this is a Linux forum y'a might as well say so what if the Sun
won't run it? Who cares?...



[1] awk '!/^#/{ printf("%s IN A %s\n", $2, $1); }'  /etc/hosts 
    /^#/{: Event not found

_______________________________________________
SWLUG Discussion List - Discuss at swlug.org.uk
http://list.swlug.org.uk/mailman/listinfo/discuss


BBCi at http://www.bbc.co.uk/

This e-mail (and any attachments) is confidential and may contain 
personal views which are not the views of the BBC unless specifically 
stated.
If you have received it in error, please delete it from your system, do 
not use, copy or disclose the information in any way nor act in 
reliance on it and notify the sender immediately. Please note that the 
BBC monitors e-mails sent or received. Further communication will 
signify your consent to this.





More information about the Swlug mailing list