Name | Modified | Size | Downloads / Week |
---|---|---|---|
Parent folder | |||
readme.txt | 2020-05-11 | 3.5 kB | |
reform_sql | 2020-05-11 | 6.7 kB | |
reform_sql.awk | 2020-05-11 | 3.1 kB | |
Totals: 3 Items | 13.3 kB | 0 |
From: cortesi@informix.com (David Cortesi) Message-Id: <1993Jan5.233008.7563@informix.com> Subject: Repost: making isql output horizontal Date: 5 Jan 93 23:30:08 GMT Reply-To: cortesi@informix.com (David Cortesi) Organization: Informix Software, Inc. X-Informix-List-Id: <news.2423> The version of this program posted earlier had 1 and 1/2 bugs, which are fixed in the following. Also note that "nawk" as distributed by Sun is suitable for executing this. # # reform.isql.output.awk # # An awk program to reformat an Informix-ISQL output listing, # changing it from vertical format to horizontal report format. # # Usage: # gawk -f invsql [dpat="data-pattern"] [lpp=n] [hpat="head-pattern"] # # <data-pattern> is a printf() pattern to format the column values # <n> is the number of lines of data per page # <head-pattern> is a printf() pattern to format the column headings # # Headings are printed only when lpp is specified as greater than zero. # See below for default heading and data patterns. # # As written, supports only 30 columns of output. See the end of the # program for how to expand this to more columns if required. # # Requires an "awk" that matches the book by Aho et.al, that is, # Gnu awk or SunOS "nawk" -- not the obsolete awk shipped by Sun, NeXT, etc. # # Author: David Cortesi (cortesi@informix.com) # # --------------------- User's Guide (wysiwig!) -------------------------- # # Standard input to invsql is an ISQL vertical-format report like this: # # order_num 1007 # order_date 03/25/1989 # customer_num 117 # backlog n # po_num 278693 # ship_date 04/23/1989 # ship_weight 125.90 # # We change it to horizontal format with optional page headings: # # order_num order_date customer_num backlog po_num ship_date ship_weight # 1007 03/25/1989 117 n 278693 04/28/1989 125.90 # 1012 06/05/1989 117 n 278701 06/09/1989 70.80 # # The program collects the column values from a group of input lines, # then prints one output line using a printf() like this: # printf(pattern,col1,col2,...,coln) # where each "col" is the string value of that column from the input. # # The default pattern is: "%nns %nns...\n" where each "nn" is the # default width of that column, which is: the larger of the width of # the heading text for that column, and the width of the data in that # column in the very first input group. # # The default is often wrong, but you can specify exact widths, and # control the format in many other ways, by specifying a printf() # pattern string as the command-line argument dpat="pattern". # # The program can print column headings at the top of each page of # data. The default is to NOT print headings -- you can paginate # the output using the pr(1) command for example. However if you # specify lpp=n, n>0, the program will print column headings before # each group of n data lines. # # The default column heading display is: # printf("\f%nns %nns...\n\n",col1,col2...coln) # where each "col" is the heading text of that column from the first # input group, and the "nn" values are as for the data pattern. # You can supply your own pattern using hpat="pattern" on the command line. # # When writing printf patterns as part of c-shell commands you need # only write the string in quotes, like this: dpat="%-5d\t%20f\n" # (The c shell does not object to backslashes in such quotes.) # # version of 1/4/93 with a bug fixed