Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Vertical bar
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===Computing=== ==== Pipe ==== {{Main|Pipeline (Unix)}} A [[pipe (Unix)|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) of 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 interface|command line]] or as part of a [[UNIX shell script|Unix shell script]] ("bash file"). In most [[Unix shell]]s (command interpreters), this is represented by the vertical bar character. For example: <code> [[grep]] -i 'blair' filename.log | [[More (command)#Unix|more]] </code> where the output from the <kbd>grep</kbd> process (all lines containing 'blair') is piped to the <kbd>more</kbd> process (which allows a command line user to read through results one page at a time). The same "pipe" feature is also found in later versions of [[DOS]] and Microsoft Windows. This usage has led to the character itself being called "pipe". ====Disjunction==== In many programming languages, the vertical bar is used to designate the [[Logical disjunction|logic operation ''or'']], either [[Bitwise operation|bitwise]] ''or'' or [[Boolean data type|logical]] ''or''. Specifically, in [[C (programming language)|C]] and other languages following [[C syntax]] conventions, such as [[C++]], [[Perl]], [[Java (programming language)|Java]] and [[C Sharp (programming language)|C#]], <code>a | b</code> denotes a [[Bitwise operation#OR|bitwise ''or'']]; whereas a double vertical bar <code>a || b</code> denotes a ([[Minimal evaluation|short-circuited]]) [[logical disjunction|logical ''or'']]. Since the character was originally not available in all [[code page]]s and keyboard layouts, [[ANSI C]] can transcribe it in form of the [[C trigraph|trigraph]] <code>??!</code>, which, outside string literals, is equivalent to the <code>|</code> character. In [[regular expression]] syntax, the vertical bar again indicates logical ''or'' ([[alternation (formal language theory)|alternation]]). For example: the Unix command <code>[[grep]] -E 'fu|bar'</code> matches lines containing 'fu' or 'bar'. ====Concatenation==== The double vertical bar operator "||" denotes [[string (computer science)|string]] [[concatenation]] in [[PL/I]], [[Rexx|REXX]], [[Object REXX|ooRexx]], standard [[ANSI SQL]], and theoretical computer science (particularly [[cryptography]]). ====Delimiter==== 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|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 (<code>/</code>) 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. ====Backus–Naur form==== In [[Backus–Naur form]], an expression consists of sequences of symbols and/or sequences separated by '|', indicating a [[Alternation (formal language theory)|choice]], the whole being a possible substitution for the symbol on the left. {{sxhl|2=bnf|1=<personal-name> ::= <name> {{!}} <initial>}} ====Concurrency operator==== In calculi of communicating processes (like [[pi-calculus]]), the vertical bar is used to indicate that processes execute in parallel. ====APL==== The pipe in [[APL (programming language)|APL]] is the modulo or ''residue'' function between two operands and the absolute value function next to one operand. ====List comprehensions==== {{Main|List comprehensions}} The vertical bar is used for list comprehensions in some functional languages, e.g. [[Haskell (programming language)|Haskell]] and [[Erlang (programming language)|Erlang]]. Compare [[#Mathematics|set-builder notation]]. ====Text markup==== The vertical bar is used as a special character in [[lightweight markup language]]s, notably [[MediaWiki]]'s [[Wikitext]] (in the templates and internal links). In LaTeX text mode, the vertical bar produces an [[em dash]] (—). The <code>\textbar</code> command can be used to produce a vertical bar.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)