heredoc in awk? avoid nasty quoting to print o/p with special characters

This is a discussion on heredoc in awk? avoid nasty quoting to print o/p with special characters within the Linux General forums, part of the Linux Forums category; Is there something akin to a "heredoc" in awk? I need to process a set of records, extract ...


Go Back   Usenet Forums > Linux Forums > Linux General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 05-02-2008
Rahul
 
Posts: n/a
Default heredoc in awk? avoid nasty quoting to print o/p with special characters

Is there something akin to a "heredoc" in awk? I need to process a set of
records, extract relevant numbers from each record and then create a
formatted multi-line output for each record. Problem is that the output
would contain a lot of special characters and using a normal print or
printf would need me to do some nasty quoting (or not?)

The desired output snippet for each record is something like this:

{"id":"town",
"label":"middleton",
"x_size":"10.22",
"y_size":"5.22",
},


Of course, I'd be using $1 (or equivalent variables) for the town,
middleton, 10.22, 5.22 etc.

Any constructs like the familiar bash

print << EOF
static blah blah
"${var_to_be_inserted}"
more static blah blah
EOF

--
Rahul
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 10:26 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0