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?
Use echo -e with \t for a tab. Like this:
echo -e "ABC 12345 \t Job Worked on DATE" >> jobs.txt
You can press Ctrl-vTab to type a raw Tab.
You can also use $'...'
c-string syntax:
echo $'ABC 12345 \t Job Worked on DATE' >> jobs.txt
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With