Vertical bar

From Wikipedia, the free encyclopedia

Note: "broken bar" and the glyph "¦" redirect here.
| ¦

v  d  e

Punctuation

apostrophe ( ' )
brackets (( )), ([ ]), ({ }), (< >)
colon ( : )
comma ( , )
dashes ( , , , )
ellipsis ( , ... )
exclamation mark ( ! )
full stop/period ( . )
guillemets ( « » )
hyphen ( -, )
question mark ( ? )
quotation marks ( ‘ ’, “ ” )
semicolon ( ; )
slash/stroke ( / )
solidus ( )

Interword separation

spaces ( ) () ()
interpunct ( · )

General typography

ampersand ( & )
at sign ( @ )
asterisk ( * )
backslash ( \ )
bullet ( )
caret ( ^ )
currency ( ¤ ) ¢, $, , £, ¥, ,
dagger/obelisk ( ) ( )
degree ( ° )
inverted exclamation point ( ¡ )
inverted question mark ( ¿ )
not sign ( ¬ )
number sign ( # )
numero sign ( )
percent and related signs
( %, ‰, )
pilcrow ( )
prime ( )
section sign ( § )
tilde/swung dash ( ~ )
umlaut/diaeresis ( ¨ )
underscore/understrike ( _ )
vertical/pipe/broken bar ( |, ¦ )

Uncommon typography

asterism ( )
index/fist ( )
therefore sign ( )
interrobang ( )
irony mark ( ؟ )
reference mark ( )
sarcasm mark

The symbol (|) has various names that refer to differing, yet sometimes related semantics: One of the more popular names is the Sheffer stroke, though often referred to as a pipe (by the Unix community) and vertical bar, verti-bar, vbar, vertical line or divider line by others.

Broken bar (¦) is a separate character.

The typical keyboard layout used in the United Kingdom features separate keys for vertical bar and broken bar; however, typically on Windows PCs the vertical bar key produces a broken-bar symbol and vice versa. North American keyboards typically have a key bearing a broken-bar symbol, which produces a vertical bar.

Contents

[edit] Etymology

The name pipe for the character "|" was a natural consequence of its usage in Unix shells, where it is used to notate the usage of the Unix pipeline construct.

[edit] Usage

[edit] Mathematics

The vertical bar is used as a mathematical symbol in

  • absolute value: | x | , read "the absolute value of x".
  • norms: \|(x_1,x_2)\|, read "the norm of x sub one, x sub two"; though Unicode also provides a special double vertical line symbol U+2016: x
  • set definition: {x | x < 2}, read "the set of x such that x is less than two". Often sets are written with a colon ':' rather than a vertical bar.
  • cardinality: | S | , read "the cardinality of the set S".
  • conditional probability: P(X | Y), read "the probability of X given Y".
  • divisibility: a | b, read "a divides b".
  • the Sheffer stroke in logic: a | b, read "a nand b".
  • evaluate: a + 3 | a = 4, read "a plus 3 evaluated for when a equals 4", or 4 + 3 = 7.

[edit] Physics

The vertical bar is used in bra-ket notation in quantum physics. Examples:

  • |\psi\rangle — The quantum mechanical state "ψ".
  • \langle\psi| — The dual state corresponding to the state above.
  • \langle\psi|\rho\rangle — The inner product of states ψ and ρ.

[edit] Computing

[edit] Backus-Naur form

In Backus-Naur form 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>

[edit] Unix

A pipe is an inter-process communication mechanism originating in Unix which allows the output (standard out and, optionally, standard error) of one process to be used as input (standard in) to another. In this way, a series of commands can be "piped" together. This provides skilled practitioners the ability to quickly perform complex processing on the command line or as part of a UNIX shell script ("batch file"). In most Unix shells (command interpreters), this is represented by the vertical bar character.

e.g. Piped UNIX commands: egrep -i 'blair' filename.log | more

Traditionally, the piping capability in UNIX is provided by the "fork and exec" feature of UNIX operating systems. The UNIX shell forks off a copy of itself for each command, connecting the output of each to the input of the next. When processing large amounts of data, all processes in the pipeline will typically be active at the same time (within the limits of the hardware used). Using the UNIX pipe mechanism, a user is able to quickly and easily build a custom program composed of a (theoretically) unlimited number of small, specialized programs.

[edit] DOS/Windows

This feature is found in later versions of DOS and Microsoft Windows.

e.g. Piped DOS command: type *.txt | more

The role of the character as a DOS operator can result in problems for command line applications such as the SQL Server BCP utility (short for "Bulk Copy Program"), where the user may wish to pass the "|" character to the application as a literal. (For example, when trying to bulk copy a file that uses the | character as a field separator.) In these cases, the ^ character can be used to escape the pipe. For example:

bcp tblImport in ImportFile.txt -c -t^|

[edit] Wiki markup

The pipe symbol is used frequently in wiki markup to separate or change parameters, e.g.

User:Example

When changed to [[User:Example|Example]]

it becomes just the plain word: Example.

[edit] Regular expression

In regular expression syntax, the pipe indicates alternation (i.e. logical OR). For example: the Unix command grep -E 'foo|bar' matches lines containing 'foo' or 'bar'.

[edit] 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 conventions, such as C++, Perl, Java and C#, (a | b) denotes a bitwise or; whilst a double vertical bar (a || b) denotes a (short-circuited) logical or.

[edit] Concatenation

In PL/I and certain dialects of SQL, the operator "||" denotes string concatenation.

[edit] Delimiter

Although not as common as commas or tabs, the vertical bar can be used as a delimiter in a flat file. An example of a pipe-delimited standard data format is LEDES 1998B.

[edit] Concurrency operator

In calculi of communicating processes (like Pi-calculus), the vertical bar is used to indicate that processes execute in parallel.

[edit] Phonetics and orthography

In the Khoisan languages and the International Phonetic Alphabet, the pipe is used to write the dental click (ǀ). A double pipe is used to write the alveolar lateral click (ǁ). Since these are technically letters, they have their own Unicode code points in the Latin Extended-B range: U+01C0 for the single bar and U+01C1 for the double bar. Longer single and double vertical bars are used to mark prosodic boundaries in the IPA.

[edit] Encoding

Despite the vertical bar being an accessible keystroke on typical North American and UK keyboards, there are cases where Web designers, Wiki editors, computer programmers, and others need to encode the vertical bar — usually because the vertical bar is a special symbol in their source code and yet a literal vertical bar needs to be displayed to the end user.

Set forth in 1963, American Standard Code for Information Interchange (ASCII-1963), one of the first widely used character maps, only had 69 display ("printable") characters; A–Z and 0–9 account for 36 of those characters. Vertical bar ("|") is the ASCII-1963 character at position 124 (decimal). Broken bar ("¦") is not part of the ASCII character set (any version) but a separate character that appeared (along with vertical bar) first in the EBCDIC family of character sets, and was copied from there into ISO 8859-1 and Unicode. The typical computer keyboard used in the United Kingdom features separate keys for "vertical bar" and "broken bar"; however most UK keyboard drivers today map both keys onto the ASCII character "vertical bar", as "broken bar" has hardly any practical application.

[edit] In common character maps

Unicode

hexadecimal (base-16): 007C

UTF-8

hexadecimal: 7C

ASCII

decimal (base-10): 124, or hexadecimal: 7C

ISO/IEC 8859-1

hexadecimal: 7C

Shift-JIS Men-Ku-Ten

1-01-35

EBCDIC (CCSID 500 variant)

hexadecimal: BB