\documentclass[10pt,a4paper]{article} % Packages \usepackage{fancyhdr} % For header and footer \usepackage{multicol} % Allows multicols in tables \usepackage{tabularx} % Intelligent column widths \usepackage{tabulary} % Used in header and footer \usepackage{hhline} % Border under tables \usepackage{graphicx} % For images \usepackage{xcolor} % For hex colours %\usepackage[utf8x]{inputenc} % For unicode character support \usepackage[T1]{fontenc} % Without this we get weird character replacements \usepackage{colortbl} % For coloured tables \usepackage{setspace} % For line height \usepackage{lastpage} % Needed for total page number \usepackage{seqsplit} % Splits long words. %\usepackage{opensans} % Can't make this work so far. Shame. Would be lovely. \usepackage[normalem]{ulem} % For underlining links % Most of the following are not required for the majority % of cheat sheets but are needed for some symbol support. \usepackage{amsmath} % Symbols \usepackage{MnSymbol} % Symbols \usepackage{wasysym} % Symbols %\usepackage[english,german,french,spanish,italian]{babel} % Languages % Document Info \author{TME520 (TME520)} \pdfinfo{ /Title (awk-english.pdf) /Creator (Cheatography) /Author (TME520 (TME520)) /Subject (awk (english) Cheat Sheet) } % Lengths and widths \addtolength{\textwidth}{6cm} \addtolength{\textheight}{-1cm} \addtolength{\hoffset}{-3cm} \addtolength{\voffset}{-2cm} \setlength{\tabcolsep}{0.2cm} % Space between columns \setlength{\headsep}{-12pt} % Reduce space between header and content \setlength{\headheight}{85pt} % If less, LaTeX automatically increases it \renewcommand{\footrulewidth}{0pt} % Remove footer line \renewcommand{\headrulewidth}{0pt} % Remove header line \renewcommand{\seqinsert}{\ifmmode\allowbreak\else\-\fi} % Hyphens in seqsplit % This two commands together give roughly % the right line height in the tables \renewcommand{\arraystretch}{1.3} \onehalfspacing % Commands \newcommand{\SetRowColor}[1]{\noalign{\gdef\RowColorName{#1}}\rowcolor{\RowColorName}} % Shortcut for row colour \newcommand{\mymulticolumn}[3]{\multicolumn{#1}{>{\columncolor{\RowColorName}}#2}{#3}} % For coloured multi-cols \newcolumntype{x}[1]{>{\raggedright}p{#1}} % New column types for ragged-right paragraph columns \newcommand{\tn}{\tabularnewline} % Required as custom column type in use % Font and Colours \definecolor{HeadBackground}{HTML}{333333} \definecolor{FootBackground}{HTML}{666666} \definecolor{TextColor}{HTML}{333333} \definecolor{DarkBackground}{HTML}{17A30D} \definecolor{LightBackground}{HTML}{F7FCF7} \renewcommand{\familydefault}{\sfdefault} \color{TextColor} % Header and Footer \pagestyle{fancy} \fancyhead{} % Set header to blank \fancyfoot{} % Set footer to blank \fancyhead[L]{ \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{C} \SetRowColor{DarkBackground} \vspace{-7pt} {\parbox{\dimexpr\textwidth-2\fboxsep\relax}{\noindent \hspace*{-6pt}\includegraphics[width=5.8cm]{/web/www.cheatography.com/public/images/cheatography_logo.pdf}} } \end{tabulary} \columnbreak \begin{tabulary}{11cm}{L} \vspace{-2pt}\large{\bf{\textcolor{DarkBackground}{\textrm{awk (english) Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{TME520 (TME520)} via \textcolor{DarkBackground}{\uline{cheatography.com/20978/cs/3902/}}} \end{tabulary} \end{multicols}} \fancyfoot[L]{ \footnotesize \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{LL} \SetRowColor{FootBackground} \mymulticolumn{2}{p{5.377cm}}{\bf\textcolor{white}{Cheatographer}} \\ \vspace{-2pt}TME520 (TME520) \\ \uline{cheatography.com/tme520} \\ \uline{\seqsplit{tme520}.com} \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Published 23rd April, 2015.\\ Updated 12th May, 2016.\\ Page {\thepage} of \pageref{LastPage}. \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Sponsor}} \\ \SetRowColor{white} \vspace{-5pt} %\includegraphics[width=48px,height=48px]{dave.jpeg} Measure your website readability!\\ www.readability-score.com \end{tabulary} \end{multicols}} \begin{document} \raggedright \raggedcolumns % Set font size to small. Switch to any value % from this page to resize cheat sheet text: % www.emerson.emory.edu/services/latex/latex_169.html \footnotesize % Small font. \begin{multicols*}{2} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Usage}} \tn \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{awk {[}-v var=val{]} 'program' {[}file1 file2...{]} \newline % Row Count 1 (+ 1) awk {[}-v var=val{]} -f progfile {[}file1 file2...{]}% Row Count 2 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{2.96 cm} x{5.04 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Predefined Variable Summary}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{FS}} & Input Field Separator, a space by default. \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} {\bf{OFS}} & Output Field Separator, a space by default. \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} {\bf{RS}} & Record Separator, a newline by default. \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} {\bf{ORS}} & Output Record Separator, a newline by default. \tn % Row Count 8 (+ 2) % Row 4 \SetRowColor{LightBackground} {\bf{NR}} & The total Number of input Records seen so far. \tn % Row Count 10 (+ 2) % Row 5 \SetRowColor{white} {\bf{NF}} & The Number of Fields in the current input record. \tn % Row Count 12 (+ 2) % Row 6 \SetRowColor{LightBackground} \{\{nobreak\}\}{\bf{FILENAME}} & The name of the current input file. If no files are specified on the command line, the value of FILENAME is "-". However, FILENAME is undefined inside the BEGIN block (unless set by getline). \tn % Row Count 20 (+ 8) % Row 7 \SetRowColor{white} {\bf{FNR}} & Contains number of lines read, but is reset for each file read. \tn % Row Count 23 (+ 3) % Row 8 \SetRowColor{LightBackground} {\bf{\$0}} & The whole line. \tn % Row Count 24 (+ 1) % Row 9 \SetRowColor{white} {\bf{\$1, \$2...\$n}} & Fields from 1 to {\emph{n}}. \tn % Row Count 26 (+ 2) % Row 10 \SetRowColor{LightBackground} {\bf{ARGC}} & The number of command line arguments (does not include options to gawk, or the program source). Dynamically changing the contents of ARGV control the files used for data. \tn % Row Count 33 (+ 7) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{2.96 cm} x{5.04 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Predefined Variable Summary (cont)}} \tn % Row 11 \SetRowColor{LightBackground} {\bf{ARGV}} & Array of command line arguments. The array is indexed from 0 to ARGC - 1. \tn % Row Count 3 (+ 3) % Row 12 \SetRowColor{white} {\bf{ARGIND}} & The index in ARGV of the current file being processed. \tn % Row Count 6 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{3.28 cm} x{4.72 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Numeric Functions}} \tn % Row 0 \SetRowColor{LightBackground} \{\{nobreak\}\}{\bf{atan2(y, x)}} & Returns the arctangent of y/x in radians. \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} {\bf{cos(expr)}} & Returns the cosine of expr, which is in radians. \tn % Row Count 5 (+ 3) % Row 2 \SetRowColor{LightBackground} {\bf{exp(expr)}} & The exponential function. \tn % Row Count 7 (+ 2) % Row 3 \SetRowColor{white} {\bf{int(expr)}} & Truncates to integer. \tn % Row Count 8 (+ 1) % Row 4 \SetRowColor{LightBackground} {\bf{log(expr)}} & The natural logarithm function. \tn % Row Count 10 (+ 2) % Row 5 \SetRowColor{white} {\bf{rand()}} & Returns a random number N, between 0 and 1, such that 0 \textless{}= N \textless{} 1. \tn % Row Count 13 (+ 3) % Row 6 \SetRowColor{LightBackground} {\bf{sin(expr)}} & Returns the sine of expr, which is in radians. \tn % Row Count 15 (+ 2) % Row 7 \SetRowColor{white} {\bf{sqrt(expr)}} & The square root function. \tn % Row Count 17 (+ 2) % Row 8 \SetRowColor{LightBackground} \{\{nobreak\}\}{\bf{srand({[}expr{]})}} & Uses expr as a new seed for the random number generator. If no expr is provided, the time of day is used. The return value is the previous seed for the random number generator. \tn % Row Count 25 (+ 8) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{3.6 cm} x{4.4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Bit Manipulation Functions}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{and(v1, v2)}} & Return the bitwise AND of the values provided by v1 and v2. \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} {\bf{compl(val)}} & Return the bitwise complement of val. \tn % Row Count 5 (+ 2) % Row 2 \SetRowColor{LightBackground} \{\{nobreak\}\}{\bf{lshift(val, count)}} & Return the value of val, shifted left by count bits. \tn % Row Count 8 (+ 3) % Row 3 \SetRowColor{white} {\bf{or(v1, v2)}} & Return the bitwise OR of the values provided by v1 and v2. \tn % Row Count 11 (+ 3) % Row 4 \SetRowColor{LightBackground} \{\{nobreak\}\}{\bf{rshift(val, count)}} & Return the value of val, shifted right by count bits. \tn % Row Count 14 (+ 3) % Row 5 \SetRowColor{white} {\bf{xor(v1, v2)}} & Return the bitwise XOR of the values provided by v1 and v2. \tn % Row Count 17 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{3.92 cm} x{4.08 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{String Functions}} \tn % Row 0 \SetRowColor{LightBackground} \{\{nobreak\}\}{\bf{asort(s {[}, d{]})}} & Returns the number of elements in the source array s. The contents of s are sorted using gawk's normal rules for comparing values, and the indexes of the sorted values of s are replaced with sequential integers starting with 1. If the optional destination array d is specified, then s is first duplicated into d, and then d is sorted, leaving the indexes of the source array s unchanged. \tn % Row Count 20 (+ 20) % Row 1 \SetRowColor{white} \{\{nobreak\}\}{\bf{asorti(s {[}, d{]})}} & Returns the number of elements in the source array s. The behavior is the same as that of asort(), except that the array indices are used for sorting, not the array values. When done, the array is indexed numerically, and the values are those of the original indices. The original values are lost; thus provide a second array if you wish to preserve the original. \tn % Row Count 39 (+ 19) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{3.92 cm} x{4.08 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{String Functions (cont)}} \tn % Row 2 \SetRowColor{LightBackground} \{\{nobreak\}\}{\bf{gensub(r, s, h {[}, t{]})}} & Search the target string t for matches of the regular expression r. If h is a string beginning with g or G, then replace all matches of r with s. Otherwise, h is a number indicating which match of r to replace. If t is not supplied, \$0 is used instead. Within the replacement text s, the sequence \textbackslash{}n, where n is a digit from 1 to 9, may be used to indicate just the text that matched the n'th parenthesized subexpression. The sequence \textbackslash{}0 represents the entire matched text, as does the character \&. Unlike sub() and gsub(), the modified string is returned as the result of the function, and the original target string is not changed. \tn % Row Count 32 (+ 32) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{3.92 cm} x{4.08 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{String Functions (cont)}} \tn % Row 3 \SetRowColor{LightBackground} \{\{nobreak\}\}{\bf{gsub(r, s {[}, t{]})}} & For each substring matching the regular expression r in the string t, substitute the string s, and return the number of substitutions. If t is not supplied, use \$0. An \& in the replacement text is replaced with the text that was actually matched. Use \textbackslash{}\& to get a literal \& (This must be typed as "\textbackslash{}\textbackslash{}\&"). \tn % Row Count 16 (+ 16) % Row 4 \SetRowColor{white} \{\{nobreak\}\}{\bf{index(s, t)}} & Returns the index of the string t in the string s, or 0 if t is not present (this implies that character indices start at one). \tn % Row Count 23 (+ 7) % Row 5 \SetRowColor{LightBackground} \{\{nobreak\}\}{\bf{length({[}s{]})}} & Returns the length of the string s, or the length of \$0 if s is not supplied. \tn % Row Count 27 (+ 4) % Row 6 \SetRowColor{white} \{\{nobreak\}\}{\bf{match(s, r {[}, a{]})}} & Returns the position in s where the regular expression r occurs, or 0 if r is not present, and sets the values of RSTART and RLENGTH. Note that the argument order is the same as for the \textasciitilde{} operator: str \textasciitilde{} re. If array a is provided, a is cleared and then elements 1 through n are filled with the portions of s that match the corresponding parenthesized subexpression in r. The 0'th element of a contains the portion of s matched by the entire regular expression r. Subscripts a{[}n, "start"{]}, and a{[}n, "length"{]} provide the starting index in the string and length respectively, of each matching substring. \tn % Row Count 58 (+ 31) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{3.92 cm} x{4.08 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{String Functions (cont)}} \tn % Row 7 \SetRowColor{LightBackground} \{\{nobreak\}\}{\bf{split(s, a {[}, r{]})}} & Splits the string s into the array a on the regular expression r, and returns the number of fields. If r is omitted, FS is used instead. The array a is cleared first. Splitting behaves identically to field splitting. \tn % Row Count 11 (+ 11) % Row 8 \SetRowColor{white} \{\{nobreak\}\}{\bf{sprintf(fmt, expr-list)}} & Prints expr-list according to fmt, and returns the resulting string. \tn % Row Count 15 (+ 4) % Row 9 \SetRowColor{LightBackground} \{\{nobreak\}\}{\bf{strtonum(str)}} & Examines str, and returns its numeric value. If str begins with a leading 0, strtonum() assumes that str is an octal number. If str begins with a leading 0x or 0X, strtonum() assumes that str is a hexadecimal number. \tn % Row Count 26 (+ 11) % Row 10 \SetRowColor{white} \{\{nobreak\}\}{\bf{sub(r, s {[}, t{]})}} & Just like gsub(), but only the first matching substring is replaced. \tn % Row Count 30 (+ 4) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{3.92 cm} x{4.08 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{String Functions (cont)}} \tn % Row 11 \SetRowColor{LightBackground} \{\{nobreak\}\}{\bf{substr(s, i {[}, n{]})}} & Returns the at most n-character substring of s starting at i. If n is omitted, the rest of s is used. \tn % Row Count 6 (+ 6) % Row 12 \SetRowColor{white} \{\{nobreak\}\}{\bf{tolower(str)}} & Returns a copy of the string str, with all the upper-case characters in str translated to their corresponding lower-case counterparts. Non-alphabetic characters are left unchanged. \tn % Row Count 15 (+ 9) % Row 13 \SetRowColor{LightBackground} \{\{nobreak\}\}{\bf{toupper(str)}} & Returns a copy of the string str, with all the lower-case characters in str translated to their corresponding upper-case counterparts. Non-alphabetic characters are left unchanged. \tn % Row Count 24 (+ 9) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{3.44 cm} x{4.56 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Operators}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{\&\& || !}} & Logical operators : AND, OR, NOT \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} {\bf{\textless{} \textless{}= == != \textgreater{}= \textgreater{} \textasciitilde{} !\textasciitilde{}}} & Comparison operators. \tn % Row Count 4 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{4 cm} x{4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{I/O Statements}} \tn % Row 0 \SetRowColor{LightBackground} \{\{nobreak\}\}{\bf{close(file {[}, how{]})}} & Close file, pipe or co-process. The optional how should only be used when closing one end of a two-way pipe to a co-process. It must be a string value, either "to" or "from". \tn % Row Count 9 (+ 9) % Row 1 \SetRowColor{white} \{\{nobreak\}\}{\bf{getline}} & Set \$0 from next input record; set NF, NR, FNR. Returns 0 on EOF and 1 on an error. Upon an error, ERRNO contains a string describing the problem. \tn % Row Count 17 (+ 8) % Row 2 \SetRowColor{LightBackground} \{\{nobreak\}\}{\bf{getline \textless{}file}} & Set \$0 from next record of file; set NF. \tn % Row Count 19 (+ 2) % Row 3 \SetRowColor{white} \{\{nobreak\}\}{\bf{getline var}} & Set var from next input record; set NR, FNR. \tn % Row Count 22 (+ 3) % Row 4 \SetRowColor{LightBackground} \{\{nobreak\}\}{\bf{getline var \textless{}file}} & Set var from next record of file. \tn % Row Count 24 (+ 2) % Row 5 \SetRowColor{white} \{\{nobreak\}\}{\bf{command | getline {[}var{]}}} & Run command piping the output either into \$0 or var, as above. If using a pipe or co-process to getline, or from print or printf within a loop, you must use close() to create new instances. \tn % Row Count 34 (+ 10) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{4 cm} x{4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{I/O Statements (cont)}} \tn % Row 6 \SetRowColor{LightBackground} \{\{nobreak\}\}{\bf{command |\& getline {[}var{]}}} & Run command as a co-process piping the output either into \$0 or var, as above. Co-processes are a gawk extension. \tn % Row Count 6 (+ 6) % Row 7 \SetRowColor{white} \{\{nobreak\}\}{\bf{next}} & Stop processing the current input record. The next input record is read and processing starts over with the first pattern in the AWK program. If the end of the input data is reached, the END block(s), if any, are executed. \tn % Row Count 18 (+ 12) % Row 8 \SetRowColor{LightBackground} \{\{nobreak\}\}{\bf{nextfile}} & Stop processing the current input file. The next input record read comes from the next input file. FILENAME and ARGIND are updated, FNR is reset to 1, and processing starts over with the first pattern in the AWK program. If the end of the input data is reached, the END block(s), are executed. \tn % Row Count 33 (+ 15) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{4 cm} x{4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{I/O Statements (cont)}} \tn % Row 9 \SetRowColor{LightBackground} \{\{nobreak\}\}{\bf{print}} & Prints the current record. The output record is terminated with the value of the ORS variable. \tn % Row Count 5 (+ 5) % Row 10 \SetRowColor{white} \{\{nobreak\}\}{\bf{print expr-list}} & Prints expressions. Each expression is separated by the value of the OFS variable. The output record is terminated with the value of the ORS variable. \tn % Row Count 13 (+ 8) % Row 11 \SetRowColor{LightBackground} \{\{nobreak\}\}{\bf{print expr-list \textgreater{}file}} & Prints expressions on file. Each expression is separated by the value of the OFS variable. The output record is terminated with the value of the ORS variable. \tn % Row Count 21 (+ 8) % Row 12 \SetRowColor{white} \{\{nobreak\}\}{\bf{printf fmt, expr-list}} & Format and print. \tn % Row Count 23 (+ 2) % Row 13 \SetRowColor{LightBackground} \{\{nobreak\}\}{\bf{printf fmt, expr-list \textgreater{}file}} & Format and print on file. \tn % Row Count 26 (+ 3) % Row 14 \SetRowColor{white} \{\{nobreak\}\}{\bf{system(cmd-line)}} & Execute the command cmd-line, and return the exit status. \tn % Row Count 29 (+ 3) % Row 15 \SetRowColor{LightBackground} \{\{nobreak\}\}{\bf{fflush({[}file{]})}} & Flush any buffers associated with the open output file or pipe file. If file is missing, then stdout is flushed. If file is the null string, then all open output files and pipes have their buffers flushed. \tn % Row Count 40 (+ 11) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{4 cm} x{4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{I/O Statements (cont)}} \tn % Row 16 \SetRowColor{LightBackground} \{\{nobreak\}\}{\bf{print ... \textgreater{}\textgreater{} file}} & Appends output to the file. \tn % Row Count 2 (+ 2) % Row 17 \SetRowColor{white} \{\{nobreak\}\}{\bf{print ... | command}} & Writes on a pipe. \tn % Row Count 4 (+ 2) % Row 18 \SetRowColor{LightBackground} \{\{nobreak\}\}{\bf{print ... |\& command}} & Sends data to a co-process. \tn % Row Count 6 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{4 cm} x{4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Time Functions}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{systime()}} & Returns the current time of day as the number of seconds since the Epoch (1970-01-01 00:00:00 UTC on POSIX systems). \tn % Row Count 6 (+ 6) % Row 1 \SetRowColor{white} {\bf{mktime(datespec)}} & Turns datespec into a time stamp of the same form as returned by systime(). The datespec is a string of the form YYYY MM DD HH MM SS{[} DST{]}. \tn % Row Count 13 (+ 7) % Row 2 \SetRowColor{LightBackground} \{\{nobreak\}\}{\bf{strftime({[}format {[}, timestamp{]}{]})}} & Formats timestamp according to the specification in format. The timestamp should be of the same form as returned by systime(). If timestamp is missing, the current time of day is used.If format is missing, a default format equivalent to the output of date(1) is used. \tn % Row Count 27 (+ 14) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{4 cm} x{4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{GNU AWK's Command Line Argument Summary}} \tn % Row 0 \SetRowColor{LightBackground} \{\{nobreak\}\}{\bf{-F fs}} {\emph{or}} {\bf{-{}-field-sepearator fs}} & Use fs for the input field separator (the value of the FS predefined variable). \tn % Row Count 4 (+ 4) % Row 1 \SetRowColor{white} \{\{nobreak\}\}{\bf{-v var=val}} {\emph{or}} {\bf{-{}-assign var=val}} & Assign the value val to the variable var, before execution of the program begins. Such variable values are available to the BEGIN block of an AWK program. \tn % Row Count 12 (+ 8) % Row 2 \SetRowColor{LightBackground} \{\{nobreak\}\}{\bf{-f program-file}} {\emph{or}} {\bf{-{}-file program-file}} & Read the AWK program source from the file program-file, instead of from the first command line argument. Multiple -f (or -{}-file) options may be used. \tn % Row Count 20 (+ 8) % Row 3 \SetRowColor{white} \{\{nobreak\}\}{\bf{-mf NNN}} {\emph{or}} {\bf{-mr NNN}} & Set various memory limits to the value NNN. The f flag sets the maximum number of fields, and the r flag sets the maximum record size (ignored by gawk, since gawk has no pre-defined limits). \tn % Row Count 30 (+ 10) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{4 cm} x{4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{GNU AWK's Command Line Argument Summary (cont)}} \tn % Row 4 \SetRowColor{LightBackground} \{\{nobreak\}\}{\bf{-W compat}} {\emph{or}} {\bf{-W traditional}} {\emph{or}} {\bf{-{}-compat-{}-traditional}} & Run in compatibility mode. In compatibility mode, gawk behaves identically to UNIX awk; none of the GNU-specific extensions are recognized. \tn % Row Count 7 (+ 7) % Row 5 \SetRowColor{white} \{\{nobreak\}\}{\bf{-W dump-variables{[}=file{]}}} {\emph{or}} {\bf{-{}-dump-variables{[}=file{]}}} & Print a sorted list of global variables, their types and final values to file. If no file is provided, gawk uses a file named awkvars.out in the current directory. \tn % Row Count 16 (+ 9) % Row 6 \SetRowColor{LightBackground} \{\{nobreak\}\}{\bf{-W help}} {\emph{or}} {\bf{-W usage}} {\emph{or}} {\bf{-{}-help}} {\emph{or}} {\bf{-{}-usage}} & Print a relatively short summary of the available options on the standard output. \tn % Row Count 21 (+ 5) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}