Download Caxton for Free · 7-day free trial of Caxton Pro, no credit card required · 8 MB · macOS 13.0+
The short answer
To open a TSV or pipe-delimited file on a Mac as a table, drag it onto Numbers, which imports delimited text files and accepts a custom delimiter for the pipe, or line it up in Terminal with the column command that is already installed. Caxton, a native Mac editor for text and data files, opens the same file as a table and as text: choose File ▸ Open…, press ⇧⌘C for View ▸ CSV Grid View if the file came up as text, and choose CSV ▸ Delimiter ▸ Tab or CSV ▸ Delimiter ▸ Pipe if the columns are wrong. Choosing a delimiter changes how the file is read and leaves the file itself unchanged.
What is a TSV or pipe-delimited file?
Both are tables written as plain text, one row to a line. TSV stands for tab-separated values, and the registered definition of the format is short: "Each record is represented as a single line," and "Fields in a record are separated from each other by a tab character." A pipe-delimited file does the same job with the | character between its values, and its name often ends in .txt, which tells you nothing about what is inside.
The difference from a CSV that matters when you open one is quoting. A CSV wraps a value in double quotes when the value contains a comma. The TSV definition has no quotes and rules the problem out instead: "Note that fields that contain tabs are not allowable in this encoding." Real files go both ways. Some programs write tabs or pipes with no quoting at all, others quote the CSV way, and the tools in this guide differ in which of the two they can read.
Two small files stand in for real exports here. The first is parts.tsv, shown with each tab drawn as ^I so that you can see it:
sku^Iname^Ibin^Inote^Iqty
A-1001^IHex bolt M8^IR1-04^Izinc plated^I1200
A-1002^IWasher M8^I^Ireorder in March^I5400
A-1003^IPipe clamp^IR2-11^Ifits 1/2" pipe | sold in pairs^I310
A-1004^ICable tie, black^IR3-02^I200 mm, UV rated^I8000
A-1005^ILabel roll^IR3-07^I"two sizes:^I50 mm and 75 mm"^I90
The second is orders.txt, a pipe-delimited export:
order_id|customer|city|note|amount
5001|Hansen GmbH|Hamburg|call first|1234.56
5002|Dupont SA||two boxes|12.50
5003|Rossi Srl|Milan|"gate 3 | north side"|999.99
5004|Ng Trading|Singapore|leave at desk, bay 4|45.00
Between them they hold what real exports hold:
- An empty value. Part A-1002 has no bin, so two tabs sit next to each other. Order 5002 has no city, so two pipes do.
- Another delimiter inside a value. The note for A-1003 contains a pipe, and the note for order 5004 contains a comma. Neither is a problem as long as the file is read with its own delimiter.
- The file's own delimiter inside a quoted value. The note for A-1005 is in double quotes with a tab inside it, and the note for order 5003 is in double quotes with a pipe inside it.
A third file, readings.tsv, has 200,000 rows under a header, for the commands that deal with length.
How do I tell whether a file is tab-separated or pipe-delimited?
Look at its first lines as text. In Terminal, head prints the start of a file, and the manual page for cat describes its -t option as one that will "display tab characters as" ^I:
head -n 3 parts.tsv | cat -t
sku^Iname^Ibin^Inote^Iqty
A-1001^IHex bolt M8^IR1-04^Izinc plated^I1200
A-1002^IWasher M8^I^Ireorder in March^I5400
A second check lists the column names. tr swaps one character for another, so swapping the delimiter for a line break puts each name in the header on a line of its own:
head -n 1 parts.tsv | tr '\t' '\n'
sku
name
bin
note
qty
Five names means five columns, split at tabs. For a pipe file, name the pipe:
head -n 1 orders.txt | tr '|' '\n'
order_id
customer
city
note
amount
If the header comes back on one line, the character you named is not the delimiter.
Without Terminal, select the file in Finder and press the Space bar. Apple describes Quick Look as "a fast, full-size preview of nearly any kind of file without opening the file." Apple's page does not list which kinds of file it draws as a table, so this guide makes no promise about how a .tsv or a pipe-delimited .txt looks there. It is a look, and for anything more you need one of the tools below.
How do I view a TSV or pipe-delimited file as a table in Terminal?
The column command is already installed on a Mac, and two of its options make a table. Its manual page describes -t as "Determine the number of columns the input contains and create a table," and -s as "Specify a set of characters to be used to delimit columns for the -t option." In Terminal, write the tab as $'\t':
column -t -s $'\t' parts.tsv
sku name bin note qty
A-1001 Hex bolt M8 R1-04 zinc plated 1200
A-1002 Washer M8 reorder in March 5400
A-1003 Pipe clamp R2-11 fits 1/2" pipe | sold in pairs 310
A-1004 Cable tie, black R3-02 200 mm, UV rated 8000
A-1005 Label roll R3-07 "two sizes: 50 mm and 75 mm" 90
Four of the six lines are right. The other two show the two limits of column.
An empty value is dropped. Part A-1002 has no bin, and column read its two tabs as one delimiter. The note moved into the bin column and the quantity into the note column, with no warning. The manual page on macOS lists four options, -c, -s, -t and -x, and none of them keeps an empty value. The way around it is to put a placeholder into the empty values first, here a hyphen, with awk:
awk -F'\t' -v OFS='\t' '{ for (i = 1; i <= NF; i++) if ($i == "") $i = "-" } 1' parts.tsv | column -t -s $'\t'
sku name bin note qty
A-1001 Hex bolt M8 R1-04 zinc plated 1200
A-1002 Washer M8 - reorder in March 5400
A-1003 Pipe clamp R2-11 fits 1/2" pipe | sold in pairs 310
A-1004 Cable tie, black R3-02 200 mm, UV rated 8000
A-1005 Label roll R3-07 "two sizes: 50 mm and 75 mm" 90
A quoted value is split. Part A-1005 has a tab inside its quoted note. column does not read quotes, so the note became two columns and the quantity landed in a sixth. None of the four options changes that.
Pipes work the same way, with the pipe in quotes after -s:
column -t -s '|' orders.txt
order_id customer city note amount
5001 Hansen GmbH Hamburg call first 1234.56
5002 Dupont SA two boxes 12.50
5003 Rossi Srl Milan "gate 3 north side" 999.99
5004 Ng Trading Singapore leave at desk, bay 4 45.00
Order 5002 lost its empty city and moved left, and the quoted note of order 5003 was cut at its pipe. The placeholder fix above works here as well, once the tab is swapped for the pipe in all three places.
For a long file, send the table to less so that it scrolls. The manual page for less describes -S as an option that "Causes lines longer than the screen width to be chopped (truncated) rather than wrapped," and the Right Arrow key brings the rest of a line into view:
column -t -s $'\t' readings.tsv | less -S
Press q to leave. One more limit is in the manual page for column itself: "Input lines are limited to LINE_MAX (2048) bytes in length." On a file with a longer line, column prints line too long and exits with an error.
How do I pick out or count columns with cut and awk?
cut prints the columns you name by number. Its manual page describes -f as a list that "specifies fields, separated in the input by the field delimiter character," and -d as "Use delim as the field delimiter character instead of the tab character." The tab is the default, so a TSV needs no -d:
cut -f 1,5 parts.tsv
sku qty
A-1001 1200
A-1002 5400
A-1003 310
A-1004 8000
A-1005 50 mm and 75 mm"
The empty bin of A-1002 did no harm here. cut counts every tab, so 5400 is still the fifth field. The last line is wrong for the same reason: the tab inside the quoted note of A-1005 was counted too, and the fifth field of that line is the end of the note and not the quantity. For pipes, name the delimiter:
cut -d '|' -f 2,5 orders.txt
customer|amount
Hansen GmbH|1234.56
Dupont SA|12.50
Rossi Srl| north side"
Ng Trading|45.00
Order 5003 shows the same fault, because the pipe inside its quoted note was counted as a delimiter.
awk picks columns too, in any order. Its manual page states that "The -F fs option defines the input field separator to be the regular expression fs," and that the fields "are denoted $1, $2, ..., while $0 refers to the entire line." This prints the quantity and then the part number:
awk -F'\t' '{ print $5, $1 }' parts.tsv
qty sku
1200 A-1001
5400 A-1002
310 A-1003
8000 A-1004
50 mm and 75 mm" A-1005
The more useful thing awk does is check the file before you trust it. The manual page lists NF as the "number of fields in the current record." Print it for every line and tally the results:
awk -F'\t' '{ print NF }' parts.tsv | sort -n | uniq -c
5 5
1 6
Five lines have five fields and one line has six. A count that differs on some lines means that a value holds the delimiter, or that a row is broken. This prints the number of each line that does not have the five fields of the header:
awk -F'\t' 'NF != 5 { print "line " NR ": " NF " fields" }' parts.tsv
line 6: 6 fields
The same check on the pipe file finds the quoted note of order 5003:
awk -F'|' '{ print NF }' orders.txt | sort -n | uniq -c
4 5
1 6
Empty values are easy to find, because awk keeps them. This lists the parts that have no bin:
awk -F'\t' '$3 == "" { print $1, $2 }' parts.tsv
A-1002 Washer M8
The same commands work on a long file. On readings.tsv, wc -l counts the lines, head with column shows the first rows as a table, and awk counts the rows whose fifth column is check:
wc -l readings.tsv
200001 readings.tsv
head -n 5 readings.tsv | column -t -s $'\t'
reading_id station taken_at temp_c status
1 ST-02 2026-11-01 00:01 4.7 ok
2 ST-03 2026-11-01 00:02 5.4 ok
3 ST-04 2026-11-01 00:03 6.1 ok
4 ST-05 2026-11-01 00:04 6.8 ok
awk -F'\t' '$5 == "check"' readings.tsv | wc -l
2061
What cut and awk cannot do is read quotes. A command-line tool that does has to be installed first, and csvkit's csvlook is one, with a -t option that its documentation describes as "Specify that the input CSV file is delimited with tabs" and a -d option for the "Delimiting character of the input CSV file."
How do I open a TSV or pipe-delimited file in Numbers?
Numbers is Apple's spreadsheet app, and its import page covers both kinds of file in one sentence: "You can import Excel spreadsheets, as well as delimited or fixed-width text files into Numbers." The step it gives is "Drag the file to the Numbers icon in the Dock or in the Applications folder," followed by "If the table doesn’t look right, you can adjust the settings."
The settings are where the delimiter is chosen. Apple's steps are to click anywhere in the table, then "In the Format sidebar, click the Table tab, then click Adjust Import Settings," then "Click the Delimited tab in the Import Settings window," then "Select one or more delimiter options next to Separate Values Using, or enter a custom delimiter," and last "Click Update Table." The page does not name the tab or the pipe among the options, so the custom delimiter is the documented place for a character that is not offered.
Two more settings on that tab matter for the sample files:
- Text Qualifier. Apple's page explains that "A text qualifier indicates where text begins and ends," and that you "Click the Text Qualifier pop-up menu and choose a character." This is the setting for values in double quotes, such as the notes of A-1005 and order 5003.
- Treat consecutive delimiters as one. Apple lists this option under "Ignore duplicate delimiters." By its name it reads two delimiters in a row as one, and two delimiters in a row is what an empty value looks like, so leave it off for a file such as parts.tsv.
Two cautions come from Apple's own pages. The first is a note on the import page: "You can’t adjust import settings after you edit the imported table." The second is that a spreadsheet interprets what it imports: "By default, Numbers formats table cells automatically, so letters and numbers are formatted and appear the way you type them." Edit a CSV without Excel changing the data covers what that means for codes, long numbers and dates, and when Numbers can't open your file covers the large ones.
When are the tools already on a Mac enough?
Often. To see what a file holds, head and Quick Look are all you need. For a file that passes the field count check above, cut and awk read every value correctly, empty values included, and nothing with a window is better at pulling one column out in a script or at running the same job on a folder of files every night. column gives a readable table for a small file once its empty values are filled. Numbers, if you have it, is the right choice when you want a spreadsheet to keep working in.
They stop being enough in three places. A quoted value that contains the delimiter is split by column, cut and awk alike. An empty value shifts a row in column unless you fill it first. And a long file in a pager is still text, where each new question, such as which rows have the status check, is another command to write.
How do I open a TSV or pipe-delimited file in Caxton?
Caxton opens a delimited file as a table that is a view of the file, not an import into a spreadsheet. The same window shows it as plain text, and none of the reading steps below writes to the file. Here is the walk with parts.tsv and orders.txt. For comma files, how to open a CSV file on a Mac is the companion guide.
1. Open the file
Drag the file onto Caxton, or choose File ▸ Open… and pick it. A file named .csv, .tsv, .psv or .dsv goes straight to the table, so parts.tsv comes up in five columns. Caxton works out the delimiter from the start of the file, up to the first 100 KB, by trying the comma, the tab, the pipe and the semicolon and keeping the one that gives the same number of columns on the most rows.
A file with any other name, .txt and .tab included, is judged by what is in it. It opens as a table when its start has the shape of one: at least ten rows, nearly all with the same number of columns. For tabs that means two or more columns in at least nine rows out of ten. For pipes, commas and semicolons it means three or more columns in at least 95 rows out of 100, a higher bar so that a log with the odd pipe in it stays text. orders.txt has five lines, so it opens as text, and step 2 turns it into a table. A longer export of the same shape opens as a table without help.
Opening and viewing are Caxton Free at any file size. The table holds up on large files as well: on the benchmarks page, a comma-separated file of 10 million rows opens to a working table in about 2 seconds, and tabs and pipes go through the same parser. A file of 300 MB or more goes through the Open Large File dialog first, and how to open a large CSV file on a Mac covers its choices.
2. Switch between the table and the text
View ▸ CSV Grid View, with the keys ⇧⌘C, turns the table on and off, and so does the CSV Grid button in the toolbar. With orders.txt open as text, press ⇧⌘C. Caxton tries the same four delimiters, finds that the pipe gives five columns on every line, and shows the table. Press the keys again to see the pipes as text. If no character gives a consistent table, the file stays in the text view, the banner Could not parse as CSV appears, and step 4 lets you name the delimiter yourself. Switching views is Caxton Free.
3. Check how the file was read
The status bar gives the size of the table, which for parts.tsv is 6 rows × 5 columns with the header counted. For the delimiter, choose View ▸ Show Inspector or press ⌥⌘I. The Structure section has a Delimiter row, which shows Tab (detected) for parts.tsv and Pipe (detected) for orders.txt, followed by the quote character, the header row, the count of records, the parse state and the number of malformed rows. The empty bin of A-1002 is an empty cell in its own column, and the quoted notes of A-1005 and order 5003 are each one cell. The Inspector is Caxton Free.
4. If the columns are wrong, choose the delimiter
CSV ▸ Delimiter lists Auto-detect, Comma, Tab, Semicolon, Pipe and a Custom… item. Choosing one makes Caxton read the file with that character, and a banner appears in the status bar, Reading as pipe-delimited for the pipe, with a note that the file is unchanged. The menu works from the text view too, where it brings up the table already read your way. The choice carries a check mark, the Inspector shows it as Pipe (chosen), and it is kept with the session. Auto-detect hands the decision back to Caxton.
The Custom… item opens a small form titled Custom Delimiter, with a Delimiter field and a Read As button. It takes one ASCII character, anything except a double quote or a line break, so a caret or a tilde works and a delimiter of two characters does not. Everything in this step is Caxton Free, and none of it rewrites the file.
5. Tell Caxton whether the first row is a header
Caxton treats the first row as the header unless you tell it otherwise. For a file that starts straight in with data, choose CSV ▸ First Row Is Header to clear its check mark. The first row becomes an ordinary row and the columns are numbered. This is Caxton Free.
6. Read, search and filter the table
Everything you do to read a table is Caxton Free at any file size. ⌘F searches the whole file. Edit ▸ Find ▸ Filter Lines, with the keys ⇧⌘L, keeps only the rows that contain a word. A right-click on a cell opens a Filter submenu that filters to that cell's value or excludes it, and CSV ▸ Advanced Filter… sets a condition for each column. Each filter is a view, and the file is not touched.
For a question about one column, click a cell in it and press ⌃⌘7 for the Column Profile. It lists the type of the column, the rows it scanned, the distinct values with a count for each, and a Blank row that counts the empty values, which is 1 for the bin column of parts.tsv. On readings.tsv, the profile of the status column answers the question that took an awk command earlier. Free ways to view a CSV file on a Mac sets these tools beside the other viewers.
7. Know what needs Caxton Pro
Changing the table is Caxton Pro at any file size: typing into a cell, filling down, deleting a row. Every download includes a 7-day free trial of Caxton Pro with no credit card required. On Caxton Free, a file of at most 10 MB when opened can still be edited and saved in the text view.
Turning a tab file into a comma file, or the other way, is a different job from reading it. That is CSV ▸ Convert Delimiter, which rewrites the file. Its preview opens on Caxton Free and applying it is Caxton Pro, and how to change a CSV's delimiter on a Mac walks through it. A .txt whose columns are lined up with spaces has no delimiter at all, and convert a fixed-width file to CSV is the guide for that kind.
8. Make the same kind of file open as a table every time
If a system sends you pipe-delimited .txt files every week, a rule saves the trip through the menu. Choose Edit ▸ File Pattern Rules…, click the + button, and type a pattern over the *.log it starts with, such as *.tab or orders-*.txt. Then change CSV: Default to CSV: Tab or CSV: Pipe, and Header: Default to Header: First row or Header: None. A plain pattern is matched against the file's name, and a pattern with a slash in it against the whole path. From then on a matching file opens as a table read with that delimiter, however short it is, and the Inspector shows Tab (from a rule) or Pipe (from a rule). File Pattern Rules is Caxton Free.
How does Caxton read quotes in a tab-separated file?
Caxton reads quotes the same way for every delimiter, tabs and pipes included. A double quote that is the first character of a value opens a quoted value. Inside it, the delimiter and a line break are part of the value, and two double quotes in a row stand for one. A double quote anywhere else in a value is an ordinary character.
In the two sample files that gives the reading you would want. The note of A-1005 stays one cell with its tab inside, and the row has five columns where cut and awk counted six. The note of order 5003 stays one cell with its pipe inside. The inch mark in fits 1/2" pipe | sold in pairs sits in the middle of a value, so it is plain text. The table shows a quoted value without its outer quotes.
There is one case to know about, because many TSV files are written with no quoting at all. Caxton has no setting that turns the reading of quotes off. In such a file, a value that begins with a double quote is still read as a quoted value, and one of two things follows:
- Text follows the closing quote. A value such as
"Big" Joeleaves its row with the right number of columns. The row is marked in the gutter and listed in the Problems panel, which ⌃⌘5 opens, as a row that has unusual quoting. - The quote never closes. A value such as
"unfinishedtakes in every tab and line break after it, up to the next double quote in the file. If there is none, a banner names the row the quote opened on and offers a Repair button, and column editing is disabled until the quote is fixed.
The Structure section of the Inspector counts such rows under Malformed rows, and the text view, one ⇧⌘C away, shows the line as it is in the file. The Problems panel and the Inspector are Caxton Free. The Repair button changes the file and is Caxton Pro. How to repair a malformed CSV on a Mac covers the fixes.
Which way of opening the file fits which job?
| The job | Terminal, Quick Look and Numbers | In Caxton |
|---|---|---|
| You want to know which delimiter a file uses. | head with cat -t or tr shows it in one line, and Quick Look needs no Terminal. | The Structure section of the Inspector names the delimiter and how it was chosen. |
| You want to read a small file with no empty values as a table. | column -t -s is enough. | The file opens as a table. |
| The file has empty values. | column moves the row to the left unless you fill the blanks first. cut and awk keep them. | An empty value is an empty cell in its own column. |
| You need one column, or a count, once or in a script. | cut and awk are the better tools here. | Filters and the Column Profile answer it by hand, one file at a time. |
| Quoted values contain the delimiter. | column, cut and awk split those values. Numbers has a Text Qualifier setting for them. | A quoted value is one cell. |
| The file is long and you want to read it as a table. | column with less -S scrolls it, within the line length that column accepts. | The table opens at any size on Caxton Free. |
| You want to keep working on the data as a spreadsheet. | Numbers is the right tool. | Caxton edits the file itself and is not a spreadsheet. |
| The file has to change to another delimiter. | That takes a tool that parses quotes, and how to change a CSV's delimiter on a Mac lists them. | CSV ▸ Convert Delimiter rewrites the file after a preview, and applying it is Caxton Pro. |
Open the file as a table, choose CSV ▸ Delimiter if the columns are wrong, and search and filter it at any size on Caxton Free.
Download Caxton for Free7-day free trial of Caxton Pro, every feature, no credit card required. After it, Caxton Free keeps opening, searching and filtering at any size, and you can edit and save files up to 10 MB as text.
Frequently asked questions
How do I open a TSV or pipe-delimited file on a Mac?
To open a TSV or pipe-delimited file on a Mac as a table, drag it onto Numbers, which imports delimited text files and accepts a custom delimiter for the pipe, or line it up in Terminal with the column command that is already installed. Caxton, a native Mac editor for text and data files, opens the same file as a table and as text: choose File ▸ Open…, press ⇧⌘C for View ▸ CSV Grid View if the file came up as text, and choose CSV ▸ Delimiter ▸ Tab or CSV ▸ Delimiter ▸ Pipe if the columns are wrong. Choosing a delimiter changes how the file is read and leaves the file itself unchanged.
Why are the columns shifted when I use column -t on a Mac?
The column command that ships with macOS reads two delimiters that sit next to each other as one. A row with an empty value loses that column, and every later value in the row moves one place to the left. The manual page lists four options, -c, -s, -t and -x, and none of them keeps an empty value. Put a placeholder such as a hyphen into the empty values before the file reaches column, with the awk command in this guide, or open the file in an app that reads it as a table.
Can Numbers open a pipe-delimited text file?
Apple's guide states that Numbers imports delimited or fixed-width text files, and that the import settings can be adjusted when the table does not look right. Click the table, click Adjust Import Settings on the Table tab of the Format sidebar, and on the Delimited tab enter the pipe as a custom delimiter, then click Update Table. Apple's page does not name the pipe or the tab among its delimiter options, and it notes that the import settings cannot be adjusted after you edit the imported table.
Does choosing a delimiter in Caxton change my file?
No. The items under CSV ▸ Delimiter decide how Caxton splits each line into columns, and every byte of the file stays as it was. Switching between the table and the text with ⇧⌘C changes nothing either. The file is written only when you save an edit. Rewriting it with another delimiter is a separate command, CSV ▸ Convert Delimiter.
What if the delimiter is more than one character, such as two pipes?
Caxton reads with one delimiter character: the comma, the tab, the pipe, the semicolon, or one ASCII character that you type in the form that CSV ▸ Delimiter ▸ Custom… opens. A file that puts two pipes between its values can be read with Pipe, and an empty column then sits between each pair of real ones. In Terminal, awk accepts a longer separator, because its manual page defines the -F option as a regular expression.
Sources
- Caxton manual: the CSV workbench, CSV Grid View and the Delimiter menu
- Caxton manual: the Inspector and its Structure section
- Caxton manual: Column Profiles
- Caxton manual: opening files and File Pattern Rules
- Caxton benchmarks: CSV open to a working grid
- IANA: the text/tab-separated-values media type and its definition of TSV
- Apple Support: Import an Excel or text file into Numbers on Mac
- Apple Support: Format dates, currency, and more in Numbers on Mac
- Apple Support: View and edit files with Quick Look on Mac
- csvkit documentation: csvlook
- csvkit documentation: arguments common to all tools
- Apple's manual pages on macOS:
man column,man cut,man awk,man head,man tr,man catandman less, read with the shipped tools in Terminal