Vertical bar

This is an old revision of this page, as edited by Siroxo (talk | contribs) at 20:04, 1 June 2004 (added etymology). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Vertical bar or pipe is the name of the ASCII character at position 124 (decimal). The character is depicted as either a solid vertical bar ("|") or a vertical bar with a break in the middle (broken bar "¦"). The character is usually depicted as a broken bar on IBM PC keyboards to distinguish it from other characters. However, today the "broken bar" is a separate character, U+00A6 (¦).

Usage:

The vertical bar is used as a mathematical symbol in

  • absolute value:  , read "the absolute value of x".
  • norms:  , read "the norm of x sub one, x sub two".
  • set definition  , read "the set of x such that x is less than two". Often sets are written with a colon ':' rather than a vertical bar.
  • conditional probility:  , read "the probability of X given Y".

In text that cannot be edited but can be selected, for example, on a web page, the cursor can also be a vertical bar, possibly with little cross bars at the top and bottom.

The vertical bar is used in links to separate a link from the displayed text. E.g., [[c programming language|C]] displays as C.

In BNF the 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>

A pipe is an operating system mechanism originating in Unix, which allows the user to direct the output of one shell command through another command. See Pipe (Unix).

In regular expressions, the vertical bar indicates alternation. E.g., grep 'foo|bar' matches lines containing 'foo' or 'bar'.

In the C, perl, and many others, it is used to designate bitwise or a|b or doubled up logical or a||b.

Etymology

The name pipe for the character "|" came into common usage due to the fact that it is used in unix to pipe the output of one program into another program.