Formatting rules and examples

This section provides details to help you get the specific output format you're looking for.

Using Column and Row Delimiters

One output option you may need is to place a specific character between table columns and/or rows in the data output. By default, columns are separated by commas ( , ) and rows are separated by new lines. This is known as "delimiting" the data so it's easier to tell where one row or column ends and another begins. You may encounter a situation in which you need to delimit rows or columns with a different character than the default options.

In the following example, the -c switch changes the column separator from a comma to a pipe character (|):

Note: While it is common to delimit columns with a pipe ( | ), this character is also used in most command line interfaces for special purposes. To avoid errors, you have to escape the pipe character with a backslash. (In a Windows command line, the | must be escaped with a caret ( ^ ) character.)
$ tendo  -u [USERNAME] pub.demo.retail.item . -c \| -o separators

The command above will produce the following results:

Including Column Names and Headers

There are two ways that columns are labeled in 1010data. Column names are the actual values 1010data uses to recognize columns in a table. Column names must be all lowercase letters and cannot include spaces or extra characters. The column names are what you use when writing 1010data expressions. Column labels, on the other hand, can use capital letters, spaces and other symbols. Labels are meant to be human readable and are disregarded by 1010data when operating on data. Column names are returned by including the -h switch. Column labels are returned by including the -H switch. These options are position dependent upon one another, as shown in the following two examples (notice we're also including the -c option to separate the columns).

$ tendo -c \| -h -H pub.demo.retail.item .

This command will produce the following results. Note that the column names are displayed first, and the column labels are displayed next:

The next example shows what happens if you reverse the order:

$ tendo -c -\| -H -h pub.demo.retail.item .

This command will place the column headings before the column names, as shown below:

You can also include a different delimiter for both column names and column labels than that provided for the actual columns. Here is an example that produces one delimiter for column names (a hyphen), one for labels (@) and a third for the columns themselves (|):
$ tendo -c \- -h -c \@ -H -c \| pub.demo.retail.item . 
Note: Notice in the above example all three delimiting characters (such as @ and |) need to be escaped with the backslash ( \ ) character.

The above example will produce the following output: