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 ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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 |