Vertical bar
|
Punctuation marks |
---|
apostrophe ( ' ) ( ’ ) |
Other typographer's marks |
ampersand ( & ) |
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, in Unicode the "broken bar" is a separate character, U+00A6 (¦
).
Contents |
Usage:
Mathematics
The vertical bar is used as a mathematical symbol in
- absolute value: <math>|x|<math>, read "the absolute value (or modulus) of x".
- norms: <math>||(x_1,x_2)||<math>, read "the norm of x sub one, x sub two"; though Unicode also provides a special double vertical line symbol U+2016: Template:UnicodexTemplate:Unicode
- set definition: <math>\{x|x<2\}<math>, 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 probability: <math>P(X|Y)<math>, read "the probability of X given Y".
- divisibility: <math>a | b<math>, read "a divides b".
Cursors
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 serifs at the top and bottom.
Wiki markup
The vertical bar is used in internal links to separate a link from the displayed text. E.g., [[c programming language|C]] displays as C.
Backus-Naur form
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>
Unix
A pipe is an operating system mechanism originating in Unix which allows the output of one process to be used as input to another. In the shell command, this is represented by the vertical bar character.
Regular Expression
In regular expressions, the pipe indicates alternation. E.g., grep 'foo|bar' matches lines containing 'foo' or 'bar'.
Disjunction
In many programming languages, it is used to designate the logic operation or, either bitwise or or logical or.
Specifically, in C and other languages following C syntax, such as Perl and Java, (a | b) denotes bitwise or; while double vertical bar (a || b) denotes logical or.
Concatenation
In PL/I and SQL, the operator "||" denotes string concatenation.
Delimiter
Although not as common as commas or tabs, the vertical bar/pipe symbol can be used as delimiter in a flat file. An example of a pipe-delimited standard data format is LEDES 1998B.
Etymology
The name pipe for the character "|" came into common usage due to the fact that it is used in the Unix shell to pipe the output of one program into another program.