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...
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
[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]