It’s in the shift position on the backslash key, idly minding its own business, but the only time I’ve used it was as “or” in programming. Regardless, this hardly seems to warrant a whole new character. Is there a better reason why it’s there? Does it have a history?
In this staff report, Una Persson (nee Anthracite) explains:
This character is called a pipe. It is used often in command-line interfaces to direct the output of one command into another. For example, in UNIX the command “ls | more” will take the text output of the “ls” command, which shows the contents of a directory (the current one in this case), and directs it into the “more” command, which breaks input into seperate “screens”. It’s present in DOS, too. Try typing “dir | more” into a DOS command prompt.
Isn’t this fundamentally the same as saying dir /p?
It also turns up in probability and statistics. P(A | B) is read “probability of A given B”. Sometimes you see it in set notation: A = {n | n prime} is read “A is the set of n’s such that n is prime”. In addition to the other computer-type uses people have given, I also use it in LaTeX to make tables.
I encountered the ‘pipe’ character | back in 7th grade (96-97) durring LOGO programming. The instructor called the pipe ’ magic markers ’ and told us at that time IBM didnt have a name or a purpose for the keystroke.
The vertical bar entered the ASCII table in 1967. I guess your question is why, but I don’t know. Maybe it was intended as a math symbol.
Its use as a pipe operator originated in Unix.
IBM looked at the ASCII table and put keys for all of the printable characters onto its PC keyboard.
Yes, but this is the heart of “the unix philosophy”. Using the /p forces the dir command to know how to split output into pages. Any command that wants that needs to put in another copy of that functionality. While unix puts all that functionality in a completely separate program (“more”) that can handle pagination for any program, and so none of the programs have pagination built in.
Yes it is, but, as SmackFusays, it’s not the point. Aside from the “/p” requiring the dir command to know how to parse screenfuls of text, what if you want to do something else such as take a huge directory listing and run it through a hypothetical filter to strain out any obscenities, then print it using another hypothetical utility that will print the listing in three columns rather than one long one? Just type “dir | nopottymouth | print3columns” Being able to pipe output from one command to another can be extremely useful, and each command only has to know its own thing.
Another hypothetical, again with dir: Today, with what’s essentially DOS 7, you can do things that dir in DOS 3.2 only dreamed of, but back then, you’d have to pipe the dir output to something else simply because dir didn’t have that function at the time.
About the Vertical Bar being called the Vertical Broken bar.
The Vertical bar or Vertical line is |
The Vertical broken bar or Vertical Broken line is ¦ (alt 0166)
The Vertical Bar is used in C++ programming, MSDOS, math and physics. Although the Vertical Bar sometimes is depicted as a Vertical Broken Bar by some programs or operating systems, depending what you are using, the Vertical Broken Bar is not used in mathematical equations.
The Solid Vertical Bar has been used as a separator on a web-page menu, used as a NAND operator in logical equations, used as a PIPE in MSDOS, and also used in C++ as an Boolean operator.
The Vertical Broken Bar can be used a separator. The Solid Vertical bar is not allowed in Windows as part of file or folder name. The Broken Vertical bar is allowed as part of a file or folder name inside a Zip Folder.
Doesn’t this character also represent zombies? It’s a stick figure with the limbs and head fallen off…
Welcome to the Dope, 'verse! Looks like you found an old thread to bring back from the dead!
This thread has rested in peace for 11+ years only to be disturbed in its grave now, but the OP’s question still isn’t answered. Blornx tells us that the character is relatively ancient. I’m pretty sure this goes back to the days before Unix used it as a pipe symbol; and in any case, I don’t believe it was added with that in mind (AFAIK).
The IBM PC ASCII character set and keyboard go back to a time well before PC existed. These characters (and the keyboard layout, mostly) go back to the days of noisy clunky Teletype machines. Those were used for telecommunications before anyone thought to use them for computer input/output. That stereotype “rat-a-tat-tat” rhythm and percussion (or faux percussion) that you hear so often at the beginning to TV newscasts originated as the sound of a newsroom full of clattering Teletypes.
A few of the standard characters got changed over the years. What we now see as a caret ^ character was originally an up-pointing arrow. What we now see as the underscore _ character was originally a left-pointing arrow. That’s how they were printed on Teletypes older than about the early 1970’s or so.
But I can’t answer the original question either. I don’t know what the original envisioned purpose of the vertical bar was, nor why it was graphically shown as a broken bar. That’s still a mystery to me.
The vertical bar character was introduced with the IBM Model 29 keypunch in 1964. Earlier IBM punchcards didn’t contain such a character encoding so we have a fairly defined date of introduction.
As to why, I believe it was to allow for the columular representation of data. Note the underscore character is introduced at the same time, allowing for primitive grid rendering. From there, it was incorporated into the EBCDIC encoding, then the ASCII encoding and then onto the standard 101-key keyboard layout.
Also the pipe character is often used several times on one line. For example
grep foo <filename> | grep bar | less
Will first find every line in the file <filename> with foo in it, then find all of those lines that have bar in it and finally redirect the output to the text viewer less.
Wikipedia has a nice article about “Vertical bar”.
An extremely detailed account of the development of ascii from earlier codes may be found here, albeit in an extremely annoying color scheme:
http://worldpowersystems.com/J/codes/
The vertical line was one of the “National Graphics” characters added in ASCII 67 adopted from ECMA-6. To find out who lobbied for various characters, and for what reasons, you would have to dig up the detailed arguments from those meetings. Whatever the reason, it probably wasn’t for potential programming use, but for some typographical or business use or perceived importance by some national group.
I use it for tallies, where [ del ] |||| [ / del ] I = [del]||||[/del] | = 6.
It was originally the logic symbol for ‘OR’, as in:
If A | B
means
If A OR B
(and, if you go back to thew IBM 3279 keyboard, that squiggle you got with Shift + 6 was a logical ‘NOT’ operand)
See Here
I use them/receive them as delimiters.