An Awk Primer/Numbers and Strings< An Awk Primer
Numbers can be expressed in Awk as either decimal integers or floating-point quantities. For example:
There is no provision for specifying values in other bases, such as hex or octal; however, as will be shown later, it is possible to output them from Awk in hex or octal format.
Strings are expressed in double quotes. For example:
"All work and no play makes Jack a homicidal maniac!"
"do re mi fa so la ti do"
Awk also supports null strings, which are represented by empty quotes:
There are various "special" characters that can be embedded into strings:
\nNewline (line feed)
\tHorizontal tab (aligns to next column of 8 spaces)
\fForm feed (possibly causes a new page, if printing)
A double-quote (
") can be embedded in a string by preceding it with a backslash, and a backslash can be embedded in a string by typing it in twice:
\\. If a backslash is used with other characters (say,
\m), it is simply treated as a normal character.