How can I put tabs in text files from Terminal?

bash, scripting, shell, terminal

Solution

Use echo -e with \t for a tab. Like this:

echo -e "ABC 12345 \t Job Worked on DATE" >> jobs.txt

Problem

When I use Terminal to find every job that has been worked on last twenty-four hours I get a text file with lines like this: ABC 12345 Job Worked on DATE DEF 67890 Another Job on DATE GHI 10112 Final Job on DATE This text file can be up to hundred lines. I have to insert all this data into a tabel in Microsoft Excel. To make my life easier I would like to figure out how to add a tab in every line, after the numbers. Something like this: ``` echo "ABC 12345 <tab> Job Worked on DATE" >> jobs.txt echo "DEF 67890 <tab> Another Job on DATE" >> jobs.txt echo "GHI 10112 <tab> Final Job on DATE" >> jobs.txt ``` How would I achieve this?

Original source