PSV File Format: Recognizing Pipe-Delimited Text
What a PSV file is, how to recognize pipe-delimited text, how it differs from CSV, and when converting to or from pipes keeps data readable and usable.
A PSV file holds pipe-separated values: plain text in which each line is a record and the vertical line character (|, Unicode U+007C) separates fields. It works like a CSV file, but it uses a pipe as the delimiter instead of a comma. This review covers how to recognize pipe-delimited text, what changes when you convert data into or out of it, and whether the result stays usable after you copy or share it.
Is pipe-delimited text the right choice for your use?
PSV makes sense when field values often contain commas and rarely contain pipes. Addresses, names written as "Last, First", free-text notes and currency figures with thousands separators all fall into this group. With pipes as the separator, these values usually need no quoting, so the raw file is easier to scan and less likely to split in the wrong place.
The main tradeoff is convention. CSV has a widely cited reference description in RFC 4180. Pipe-delimited text has no comparably recognized formal specification. Quoting, escaping, header rows and line endings vary from one producer to the next, so the sender and receiver have to agree on the dialect rather than rely on a shared default.
- PSV tends to fit:
- Data exchanges where both sides have agreed on pipe delimiting
- Exports whose fields commonly contain commas
- Logs or extracts that people read in a terminal or text editor
- Standard CSV tends to fit better:
- The recipient or tool expects CSV by default
- You cannot confirm that the importing software accepts a custom delimiter
- A formatted table or plain prose is better:
- The audience is people reading, not software parsing
- Accessibility matters more than machine import
How to recognize pipe-delimited text
A .psv extension is a hint, not proof. Pipe-delimited data often ships with .txt, .dat or even .csv extensions, so check the content itself. Signs of PSV include:
- Every line has the same number of pipe characters, apart from a possible header or trailer line.
- The first line reads like column names separated by pipes.
- Commas appear inside fields but do not line up into consistent columns.
- Lines may begin and end with a pipe. This is common in database console output and Markdown-style tables, and it adds an empty field at each end if parsed naively.
- Quotation marks around fields are rare or absent, since commas inside values no longer need protecting.
A quick structural check is to count the fields on each line. If almost every line reports the same count, a pipe is probably the delimiter. In awk, a single-character field separator other than a space is treated literally, so the pipe needs no escaping here:
awk -F'|' '{print NF}' data.psv | sort | uniq -c
Some parsing libraries can also guess delimiters automatically. Python's csv.Sniffer is one documented example. Treat any automatic guess as a hypothesis to confirm against the data, especially for short samples or files where several candidate characters appear.
Watch for characters that look like a pipe but are not U+007C:
- Broken bar ¦ (U+00A6)
- Fullwidth vertical line | (U+FF5C)
- Box-drawing vertical │ (U+2502)
- A parser told to split on the ASCII pipe will not split on any of these. Text copied from styled documents, rendered tables or decorative "font" generators can carry these substitutes. Lines that look correctly delimited can then parse as a single field.
What converting to or from PSV actually changes
Changing the delimiter changes the stored characters in the file. It is not a visual effect. A comma-to-pipe conversion replaces the separator bytes between fields. It may also remove quotation marks that were only there to protect embedded commas. The field values themselves should come through unchanged. The example below shows a typical CSV record and one valid pipe-delimited equivalent:
CSV input:
id,name,city
1,"Smith, Jane",Austin
PSV output:
id|name|city
1|Smith, Jane|Austin
The quotes around "Smith, Jane" are gone because the comma no longer conflicts with the delimiter. Some converters keep the quotes anyway. Both outputs carry the same data, as long as the receiving parser applies the same quoting rule.
The risk runs the other way when a value contains a pipe. That field must then be quoted or escaped, and dialects handle this differently. Common approaches include CSV-style double quotes, a backslash before the pipe, or replacing the character outright. Check a sample that contains a literal pipe before trusting any conversion. Silent truncation or column shifting is the usual way meaning gets lost.
"Reverse" and "mirror" sometimes come up in delimited-text tools, so it helps to separate them from PSV conversion. Reordering columns or reversing row order changes the stored arrangement of records. Neither should touch the characters inside a field. Changing the delimiter does not reverse, mirror or restyle any text.
Will it stay readable and usable after copying or sharing?
Raw PSV is plain ASCII punctuation, so the pipe characters themselves survive most copy-and-paste paths intact. Problems usually come from how the destination interprets those pipes:
| Situation | What can happen | Safer approach |
| Markdown with pipe tables (for example, GitHub Flavored Markdown) | Pipe-delimited lines may render as a table or break an existing one; the spec uses | to escape a literal pipe inside a cell | Put raw PSV in a fenced code block |
| Spreadsheet import | The file may load into one column if the delimiter is not recognized | Choose the pipe as a custom delimiter during import, if the application offers that |
| Regular-expression search | In extended regex syntax, such as grep -E, | means alternation, not a literal pipe | Escape it as | or use fixed-string search |
| Rich-text editors or styled sources | Pipes may be swapped for lookalike characters | Check the character code before parsing |
Fields with right-to-left text, such as Arabic or Hebrew, can display in a confusing order. Under the Unicode bidirectional algorithm, the pipe is a neutral character, so a raw line may show its segments in a different visual order than they are stored. The file data stays the same, and parsers read the stored order. A person scanning the raw line, however, may misread which value belongs to which column. For this kind of data, view it in a real table rather than as raw text.
For screen reader users, raw delimited text is hard to follow no matter which delimiter it uses. Whether the pipe is announced, and how, depends on the screen reader and its punctuation settings. This review has no tested results for specific assistive technologies. When people rather than programs are the audience, provide the data as a properly marked-up table or a plain-language summary alongside the PSV file.
Evidence gaps
No confirmed evidence was supplied about specific PSV tools, converters, spreadsheet applications or screen readers. The behavior described here follows general, documented principles of delimited text, Unicode and common command-line utilities. It is not based on tests of particular products. Before relying on a specific tool or destination, check its documentation and run a scoped test with your own data. Include rows with embedded commas, embedded pipes, empty fields and any non-Latin text.