The vertical bar ( | ) is a computer character and glyph with various uses in mathematics, computing, and typography. It has many names, often related to particular meanings: Sheffer stroke (in logic), verti-bar, vbar, stick, vertical line, vertical slash,bar, pike, or pipe, and several variants on these names. It is occasionally considered an allograph of broken bar (see below).
determinant: , read "the determinant of the matrixA". When the matrix entries are written out, the determinant is denoted by surrounding the matrix entries by vertical bars instead of the usual brackets or parentheses of the matrix, as in .
distance: , denoting the shortest distance between point to line , so line is perpendicular to line
divisibility: , read "adividesb" or "a is a factor of b", though Unicode also provides special 'divides' and 'does not divide' symbols (U+2223 and U+2224: ∣, ∤)
evaluation: , read "f of x, evaluated atx equals 4" (see subscripts at Wikibooks)
norm: , read "the norm of the (greater-than-one-dimensional) vector " (note that absolute value is a one-dimensional norm), although a double vertical bar (see below) is more often used to avoid ambiguity.
A pipe is an inter-process communication mechanism originating in Unix, which directs the output (standard out and, optionally, standard error) of one process to the input (standard in) to another. In this way, a series of commands can be "piped" together, giving users the ability to quickly perform complex multi-stage processing from the command line or as part of a Unix shell script ("bash file"). In most Unix shells (command interpreters), this is represented by the vertical bar character. For example:
Specifically, in C and other languages following C syntax conventions, such as C++, Perl, Java and C#, a | b denotes a bitwise or; whereas a double vertical bar a || b denotes a (short-circuited) logical or. Since the character was originally not available in all code pages and keyboard layouts, ANSI C can transcribe it in form of the trigraph??!, which, outside string literals, is equivalent to the | character.
In regular expression syntax, the vertical bar again indicates logical or (alternation). For example: the Unix command grep -E 'fu|bar' matches lines containing 'fu' or 'bar'.
Although not as common as commas or tabs, the vertical bar can be used as a delimiter in a flat file. Examples of a pipe-delimited standard data format are LEDES 1998B and HL7. It is frequently used because vertical bars are typically uncommon in the data itself.
Similarly, the vertical bar may see use as a delimiter for regular expression operations (e.g. in sed). This is useful when the regular expression contains instances of the more common forward slash (/) delimiter; using a vertical bar eliminates the need to escape all instances of the forward slash. However, this makes the bar unusable as the regular expression "alternative" operator.
In Backus–Naur form, an expression consists of sequences of symbols and/or sequences separated by '|', indicating a choice, the whole being a possible substitution for the symbol on the left.
<personal-name>::=<name> | <initial>
In calculi of communicating processes (like pi-calculus), the vertical bar is used to indicate that processes execute in parallel.
The pipe in APL is the modulo or residue function between two operands and the absolute value function next to one operand.
In the Geneva Bible and early printings of the King James Version, a double vertical bar is used to mark margin notes that contain an alternative translation from the original text. These margin notes always begin with the conjunction "Or". In later printings of the King James Version, the double vertical bar is irregularly used to mark any comment in the margins.
The vertical bar is encoded in ASCII and Unicode at U+007C|VERTICAL LINE (124decimal). In URL a vertical bar can be encoded by %7C.
Many early video terminals and dot-matrix printers rendered the vertical bar character as the allographbroken bar (¦). This may have been to distinguish the character from the lower-case 'L' and the upper-case 'I' on these limited-resolution devices. It may also have been designed so a vertical column drew a more attractive small-dash line, and to match the appearance of a horizontal line of dash characters (----).
Some variants of EBCDIC included both versions of the character as different code points. The broad implementation of the extended ASCIIISO/IEC 8859 series in the 1990s made a distinction between the two forms. This was preserved in Unicode as a separate character, U+00A6¦BROKEN BAR (166decimal) (the term "parted rule" is used sometimes in Unicode documentation).
Many keyboards display the broken bar on a keycap even though the solid vertical bar character is produced. This includes older IBM PC keyboards, and many German QWERTZ keyboards. The UK keyboard layout is actually documented as producing the broken bar but produces the solid bar on most systems, including Microsoft Windows.
The broken bar character can be typed (depending on the layout) as AltGr+` or AltGr+6 or AltGr+⇧ Shift+Right \on Windows and Compose!^ on Linux. It can be inserted into HTML as ¦
Many fonts draw the characters the same (both are solid vertical bars, or both are broken vertical bars). The broken bar has hardly any practical application and does not appear to have any clearly identified uses distinct from the vertical bar. In non-computing use — for example in mathematics, physics and general typography — the broken bar is not an acceptable substitute for the vertical bar.
In LaTeX, the vertical bar can be used as delimiter in mathematical mode. The sequence \| creates a double vertical line (a | b \| c is set as ). This has different spacing from \mid and \parallel, which are relational operators: a \mid b \parallel c is set as . In LaTeX text mode, the vertical bar produces an em dash (—). The \textbar command can be used to produce a vertical bar.