[SWLUG] Awk is driving me MAD!
Terry John
terry.john at bbc.co.uk
Tue Jun 10 16:34:26 UTC 2003
Try
awk '{printf("%s",$2); printf(" IN A "); print $1}' /etc/hosts
Terry
-----Original Message-----
From: Tim Bonnell [mailto:Tim.Bonnell at CarringtonWire.com]
Sent: 10 June 2003 17:16
To: 'discuss at swlug.org.uk'
Subject: [SWLUG] Awk is driving me MAD!
I'm implementine a DNS server. Everything seems to be working.
Now its time to convert my lengthy hosts file into a DNS file.
I tried this simple line:
# awk '{print $2 " IN A " $1}' hosts
and it just wont work!
# awk '{print $1 " IN A " $2}' hosts
# awk '{print $1 " IN A " $1}' hosts
# awk '{print $2 " IN A " $2}' hosts
all work, but thats no use to me. I basically need to swap the fields around
with a bit of text between.
Go on, tell me what a pratt I'm being!
Regards, Tim
+------------------------------------------------+
| Tim.Bonnell at CarringtonWire.com |
| IT Manager - Carrington Wire Cardiff |
| PO Box 56, Pengam Works, Cardiff CF24 2WR |
| Tel:+44(0) 29 20256100 Fax:+44(0) 29 20256101 |
| www.CarringtonWire.com |
+------------------------------------------------+
****** Internet Email Confidentiality ******
Privileged/Confidential Information may be contained in this message. If
you are not the addressee indicated in this message (or responsible for
delivery of the message to such person), you may not copy or deliver this
message to anyone. In such case, you should destroy this message and kindly
notify the sender by reply email. Please advise immediately if you or your
employer do not consent to Internet email for messages of this kind.
Opinions, conclusions and other information in this message that do not
relate to the official business of Carrington Wire Ltd shall be understood
as neither given nor endorsed by it.
********************************************
_______________________________________________
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