Glindra
Documentation Index Download
Command Line File Handling and ASCII Tools

Syntax Options - Strings and Numbers

The syntax options control how (and if) an item is written out. They will typically appear as suboptions to some other option.

Basic Syntax Options

These two suboptions control if an item should be written out at all, if it should be left or right justified, and the width of the field.

There may be various other formatting suboptions that are specific to each different data type, but width and hide are always available for all data types where you can specify a format.

Example (Windows)
> d -date=hide -size=(width=10) 
Example (Linux)
> d -date=hide -size=\(width=10\) 
Suboptions
width = n
Minimum width in characters. 0 means left adjusted.
hide Hide the item.

width = n

A positive value specifies the minimum width to be used. If the actual length of the data item is less than the width n, the data item will be placed right adjusted in a field of that width. If the actual length of the data item is greater, the data will just use as many positions as it needs. It is not considered an error of any kind if the length of the data is greater than the minimum width specified by width.

If width equals 0, the data will be written out left justified using as many positions as it needs.

A negative width value specifies a minimum field length of -n positions, where the data should be put left justified. If the actual length of the data item was less than the specified width, the positions up to the specified width should be filled with blanks, and the current position set at the end of these blanks.

hide

Specifies that the item should not be written out at all.

If you type

> d -size=hide

you will get a directory listing without any file sizes.

This is exactly the same as

> d -nosize

Uplow Syntax Options

The d directory command has an option -date, which controls how the dates of files are written out. The -date option accepts the uplow syntax suboptions (along with other formatting options described elsewhere), to specify if the name of the month should be written out in upper or lower case.

Example
d -date=upper

Prints the dates as 11-JAN-2005, with the name of the month in upper case.

Suboptions
exact Exact case.
noexact Same meaning as lower.
lower lower case.
upper UPPER CASE.
title Title Case.
width = n Minimum width in characters. 0 means left adjusted.
hide Hide the item.

Converts to upper, lower or title case, or leaves the case as it is. Both the English letters A-Z and national letters in the ISO-8859-1 alphabet are converted.

exact
noexact
lower
upper

For the case option, valid keywords are exact, noexact, lower, upper, and title. There is no semantic difference between just lower and case=lower. The keywords may be abbreviated as long as they are unique.

If the -case option is specified without a value, the default keyword is exact.

title

"Title case" means that the first letter in each word is in upper case, and all other letters are in lower case.

The definition of what constitutes a "word" is very straight-forward: a word may consist of letters (including the national ones) and digits. All other characters count as delimiters. Although this definition is sufficient to cover the most basic cases, you may well find it too simplistic to handle more complicated cases involving natural languages.

For example, the input string "S:t Patrick's Day" would be formatted as "S:T Patrick'S Day", which is not overly impressive.

Num Syntax Options

Example (Windows)
d -size=(octal group_separator=" ")
Example (Linux)
d -size=\(octal group_separator=" "\)
Options
radix = n Radix (base) for the number. Default is 10.
binary Radix 2.
octal Radix 8.
hexadecimal Radix 16.
zero_fill Fills out the number with leading zeros
A character like , to get numbers written like 1,234
width = n Minimum width in characters. 0 means left adjusted.
hide Hide the item.
These options are for writing out numbers. At present, they can only handle integers.

radix = n
binary
octal
hexadecimal

Sets the radix. Default is 10, use 8 for octal and 16 for hexadecimal. Other values between 2 and 36 are also acceptable.

zero_fill

Fills out the number with leading zeros. This option only has effect for right adjusted numbers.

group_separator

To get large numbers written with some character as a separator between every third digit, you specify the character you want with this option.

group_separator=',' will print the number 1234567 as 1,234,567.

If you do not want this kind of grouping, you should leave the group separator character as '\0', which is the default, or specify nogroup_separator explicitly.