تحويل CSV إلى نص على Mac
تحويل CSV إلى ملف نصي على Mac: تصدير نص مفصول بتاب من Numbers، تغيير الفاصل بأمر طرفية واحد، أو حفظ نص عادي في TextEdit. ثلاث طرق بسيطة ومجانية.
Convert CSV to text on macOS
Going from CSV back to text on a Mac is just as easy as the other direction. Numbers can export tab-separated text, the Terminal can swap the delimiter for anything you need, and TextEdit can produce a plain-text file. Choose the one that matches your goal.
Prefer a browser? The CSV to Text converter gives you plain, tab, pipe, space and fixed-width output with a live preview.
Method 1: Export from Numbers
If your CSV is open (or imported) in Numbers, you can export tab-separated text, which most tools accept:
- Open the CSV in Numbers (double-click, or File → Open).
- Choose File → Export To → CSV… for comma text, or copy the cells and paste into a text editor for tab-separated text.
- Set encoding to Unicode (UTF-8) and save.
Numbers does not export pipe or fixed-width directly — for those, use the Terminal or the online tool.
Method 2: Change the delimiter in Terminal
To turn comma CSV into another delimited text format, swap the separator. For simple data without quoted commas, tr or sed is enough:
tr ',' '\t' < input.csv > output.txtsed 's/,/|/g' input.csv > output.txtIf fields contain quoted commas, those simple replacements are unsafe — use csvkit instead:
csvformat -D '|' input.csv > output.txt # pipe-delimited
csvformat -T input.csv > output.txt # tab-delimitedMethod 3: Plain text in TextEdit
For a quick plain-text version, open the CSV in TextEdit and convert it to plain text:
- Open the file in TextEdit (right-click → Open With).
- Choose Format → Make Plain Text if it opened as rich text.
- Edit if needed, then save with UTF-8 encoding.
This keeps the raw comma-separated content as a .txt; to remove the structure entirely, use the CSV to plain text tool.
Choosing the safe method on a Mac
The right method depends on whether your data contains quoted commas. If it does not, tr and sed are instant and perfectly safe for swapping a delimiter. If it might — addresses, notes, anything free-form — those tools will corrupt the rows by replacing commas inside fields, so use csvkit’s csvformat, which respects quoting, or export from Numbers.
Numbers is the friendliest option for one-off jobs because it shows the data first, but it only exports comma and tab variants; for pipe or fixed-width text, the Terminal or the online tool is the way to go. Whichever route you choose, verify the output by opening it in a plain-text editor and checking that fields which originally contained commas are still intact — that single check catches the most common mistake when converting CSV back to text.
If you convert CSVs back to text regularly, save your chosen Terminal command as a shell function in ~/.zshrc, or wrap it in a Shortcuts quick action so it appears in Finder’s right-click menu. Either way you turn a multi-step task into a single action, and because the work happens locally the data never leaves your machine — the same privacy guarantee as the browser tool.
In short, pick Numbers for a quick visual export, the Terminal for control over the delimiter, and csvkit whenever fields might contain commas. With the right method for your data, converting CSV back to text on a Mac is a few seconds’ work and stays entirely on your machine.
Convert CSV to Text on Mac — FAQ
How do I convert CSV to text on a Mac?
Export from Numbers, swap the delimiter with tr/sed/csvkit in Terminal, or make plain text in TextEdit.
How do I keep the delimiter when converting?
Use csvkit’s csvformat -D or -T to set a pipe or tab safely, even with quoted fields.
Why are simple tr/sed replacements risky?
They also change commas inside quoted fields; csvkit respects quoting.
Is there a browser option?
Yes — the CSV to Text converter handles plain, tab, pipe, space and fixed-width output.