Explanation regarding escape formating

Hi ! experts

I would like to understand escape formating in awk, please anyone explain about the same using following datafile

 DATA SET: ./myfile.asc
             TIME: 29-OCT-2011 08:15 to 15-DEC-2011 16:15
             ax: 73.1
             aY: 15.2
             aZ: -8.361
 Column  1: var_1 is xyz (cm/s)
 Column  2: var_2 is axyz (cm/s)
 Column  3: var_3 is abcde (cm/s)
 Column  4: cnst is constant
                            var_1  var_2 var_3  cnst
29-OCT-2011 08:30:00 /    1:   ....   ....   ....  1.000
29-OCT-2011 09:00:00 /    2:   ....   ....   ....  1.000
29-OCT-2011 09:30:00 /    3:   ....   ....   ....  1.000
29-OCT-2011 10:00:00 /    4:   ....   ....   ....  1.000
29-OCT-2011 10:30:00 /    5:   ....   ....   ....  1.000

from datafile I want to print like below

29-OCT-2011 08:15  15-DEC-2011 16:15 73.1 15.2 -8.361 29-OCT-2011 08:30:00       ....   ....   ....  1.000
29-OCT-2011 08:15  15-DEC-2011 16:15 73.1 15.2 -8.361 29-OCT-2011 09:00:00       ....   ....   ....  1.000
29-OCT-2011 08:15  15-DEC-2011 16:15 73.1 15.2 -8.361 29-OCT-2011 09:30:00       ....   ....   ....  1.000
29-OCT-2011 08:15  15-DEC-2011 16:15 73.1 15.2 -8.361 29-OCT-2011 10:00:00       ....   ....   ....  1.000
29-OCT-2011 08:15  15-DEC-2011 16:15 73.1 15.2 -8.361 29-OCT-2011 10:30:00       ....   ....   ....  1.000

also please explain the same so that I can learn something from you

I didn't quite understand what you meant by escape formatting.

But you can produce your expected output using:

awk '
        /TIME:/ {
                        T = $0
                        gsub(/[ \t]*TIME: | to/, x, T)
        }
        /ax:/ {
                        AX = $NF
        }
        /aY:/ {
                        AY = $NF
        }
        /aZ:/ {
                        AZ = $NF
        }
        /^[0-9]/ {
                        R = $0
                        sub(/\/[ \t]*[0-9]*:/, x, R)
                        print T, AX, AY, AZ, R
        }
' datafile

Google is your friend here:-

http://ascii-table.com/ansi-escape-sequences.php

Some of these can be used in awk...

Basic ones are...

1) Colours:  ......"\033[0;31;40m Some text..."...... Gives '\033' an octal value for character 27, '[' separater for the colours needed, '0' select standard _font_, ';' further separaters, '31' foreground colour, '40' background colour, 'm' notifies that colours and _fonts_ are going to be generated. FG and BG colours have a selection of 8 basic colours

2) Force a print porition: "\033[10;20f Some text..."...... Will position the cursor to 10 lines down and 20 characters across, 'f' here meaning FORCE...

Many others available just Google...

NOTE: Some ANSI Esc codes don't work inside some shells/terminals...

Please mr Yoda explain code..and thanks for informing about wrong title

The code is pretty much straightforward. Here is the explanation:

awk '
        /TIME:/ {                                       # Search pattern: TIME:
                        T = $0                          # If found assign current record: $0 to variable: T
                        gsub(/[ \t]*TIME: | to/, x, T)  # Substitute 0 or more occurrence of space or tab followed by TIME: with null in variable: T
        }                                               # Also Substitute space followed by to with null in variable: T

        /ax:/ {                                         # Search pattern: ax:
                        AX = $NF                        # If found assign last field: $NF to variable: AX
        }

        /aY:/ {                                         # Search pattern: aY:
                        AY = $NF                        # If found assign last field: $NF to variable: AY
        }

        /aZ:/ {                                         # Search pattern: aZ:
                        AZ = $NF                        # If found assign last field: $NF to variable: AZ
        }

        /^[0-9]/ {                                      # Search pattern: ^[0-9] (record starting with digits)
                        R = $0                          # If found assign current record: $0 to variable: R
                        sub(/\/[ \t]*[0-9]*:/, x, R)    # Substitute 0 or more occurrence of space or tab & by 0 or more occurrence of digits with null
                        print T, AX, AY, AZ, R          # Print values of all variables.
        }

' file

Thank you so much Yoda

if suppose pattern say in current example

ax:73.1(73.01)

then how to use gsub I need only first

73.1 
echo "ax:73.1(73.01)" | awk ' { gsub(/.*:|\(.*/,x) }1 '

For further reference: GAWK String Functions

[LEFT]Thank you so much, though awk looks simple, but being Fortran programmer I feel it's difficult to adapt new skills. Thank you once again for your useful reply.
[/LEFT]

Fortran is kind of a thing of its own, "porting" it looks strange in any language. Best to rewrite.